In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article focuses on "how to install and run Python applications in an isolated environment". Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let the editor take you to learn how to install and run Python applications in an isolated environment.
Install Pipx
The Python 3.6 +, Pip, and venv modules are required to install pipx. Be sure to install them as described in the following guide.
How to use Pip to manage Python packages
Here, venv is needed to create a virtual environment.
Next, run the following command to install Pipx.
$python3-m pip install-- user pipx$ python3-m userpath append ~ / .local/bin
The default location for pipx binaries is ~ / .local / bin. You can override it with the PIPX_BIN_DIR environment variable. If you want to override PIPX_BIN_DIR, just run userpath append $PIPX_BIN_DIR and make sure it's in your path.
The default virtual environment location for Pipx is ~ / .local / pipx. This can be overridden with the environment variable PIPX_HOME.
Let's move on to how to install Python applications using Pipx.
Use Pipx to install and run Python applications in an isolated environment
Here are a few examples of getting started with Pipx
Install the Python package
To install Python applications, such as cowsay, globally, run:
$pipx install cowsay
This command automatically creates a virtual environment in which the package is installed and the executable file for the package is placed in $PATH.
Sample output:
Installed package cowsay 2.0.3, Python 3.6.8These binaries are now globally available- cowsaydone! ✨? ✨
Install the Python application using Pipx
Let's test the newly installed cowsay program:
one
Here, I have extracted these examples from the official website. You can install / test any other Python package.
List Python packages
To list all installed applications using Pipx, run:
$pipx list
Sample output:
Venvs are in / home/sk/.local/pipx/venvsbinaries are exposed on your $PATH at / home/sk/.local/binpackage cowsay 2.0.3, Python 3.6.8-cowsay
If you have not installed any packages, you will see the following output:
Nothing has been installed with pipx? Upgrade package
To upgrade the package, simply do the following:
$pipx upgrade cowsay
To upgrade all installed packages at once, use:
$pipx upgrade-all runs the application from the temporary virtual environment
Sometimes, you may want to run a specific Python program, but do not actually install it.
$pipx run pycowsay moooo
Running Python applications in a temporarily isolated virtual environment
This command does not actually install the specified program, but runs it from a temporary virtual environment. You can use this command to quickly test the Python application.
You can even run the .py file directly.
$pipx run https://gist.githubusercontent.com/cs01/fa721a17a326e551ede048c5088f9e0f/raw/6bdfbb6e9c1132b1c38fdd2f195d4a24c540c324/pipx-demo.pypipx is working! Uninstall the package
You can uninstall the package using the following command:
$pipx uninstall cowsay
To delete all installed packages:
$pipx uninstall-all gets help
To view the help section, run:
$pipx-help
That's it. If you are always looking for a secure, convenient and reliable program to install and run Python applications, Pipx may be a good choice.
At this point, I believe you have a deeper understanding of "how to install and run Python applications in an isolated environment". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.