SoFunction
Updated on 2024-10-29

pip install how to specify the package installation path

pip install specifies the installation directory

pip install will generally have a default installation directory, which can be changed by using thepython -m siteto view it, and of course the default directory can be modified via thepip install --target=path_name package_name

Python defaults to the system installed 2.7

python3 is version 3.8.

USER_BASE and USER_SITE are actually user-defined base paths for enabling Python scripts and dependent installers.

user_site is actually the default installation path of one's site-packages

/home/szr/.localDocuments under

/home/szr/.local/lib/python3.8/site-packagesIt's an installed package.

beta (software)pip3 install and pip installThe default installation path is python 3.8, and the path is in the/home/szr/.local/lib/python3.8/site-packages

pip

pip3

importationpython3 -m site -helpThe configuration file was found to have user-base and user-site definitions in the/usr/lib/python3.8/ [--user-base] [--user-site]the following

Change pip installation path

mkdir packages existpath /home/szr/.local/lib/python3.8/arrive at (a decision, conclusion etc)
The original definition of None (which is actually the path that will eventually be returned to the/home/szr/.local/lib/python3.8/site-packages) was replaced by/home/szr/.local/lib/python3.8/packages

USER_SITE = "/home/szr/.local/lib/python3.8/site-packages "

This is the path to the site-packages you want to install and download.

And the paths to scripts such as pip that perform downloads are provided by theUSER_BASEdecision, and must must be switched to the same one that has thepip scriptThis path is unchanged under the path of

Pre-modification:

Modified:

pip install numpy

There were strange warnings but it installed successfully

distutils: When you decide to distribute your module for use by others, distutils provides them with a standard way to install your module on their machines. ("Dist" in "distutils" means to distribute, as in handing out software to others.)

pip show numpy

It is installed in the directory previously set under:/home/szr/.local/lib/python3.8/packages
Indicates that the path change was successful

show (a ticket)/home/szr/.local/lib/python3.8/packages The numpy does exist.

dist-packagescap (a poem)site-packagesmake a distinction

Also: observe and find out that there aredist-packagescap (a poem)site-packages

/usr/local/lib/python3.8/dist-packages

If it isThe system comes with python, will usedist-packagescatalogs

if youInstalling python manually, it will directly use the catalogsite-packages

This allows you to keep the two installations isolated

dist-packagesis a Debian-specific convention that also exists in its derivatives, such as Ubuntu.Modules are installed into dist-packages when they are accessed from the Debian package manager at the following location:

as if/usr/lib/python2.7/dist-packages
Since easy_install and pip are installed from a package manager, they also use dist-packages, but they place the packages here:

/usr/local/lib/python2.7/dist-packages

From the Debian Python Wiki:

dist-packages instead of site-packages. third-party Python software installed from Debian packages goes into dist packages instead of site packages. This is to minimize conflicts between system Python and any source Python builds you may have installed manually.

This means that ifYou install Python manually from source, it will use the site-packages directory. This allows you to keep the two installations separate, especially since Debian and Ubuntu rely on the system version of Python for many of their system utilities.

Changing the Default Dependency Path of pip install for Python

About anacondahttps:///article/

summarize

to this article on pip install how to specify the installation path of the package is introduced to this article, more related pip specify the installation path of the package content please search for my previous articles or continue to browse the following related articles I hope you will support me in the future more!