Some common uses of pip - Python

pip uninstall command library

python unstall filename

pip update command

python -m pip install --upgrade pip

pip modify the file the default installation path

python -m site

First, we will find the above command, pip default installation path is as follows Here Insert Picture Description
, but personally do not like because there are too many files in the system tray, so I want to change the default download location, so I took a turn in this command .

python -m site -help

Here Insert Picture Description
Here I know, his profile is site.py, I only need to modify his configuration on it.

# Prefixes for site-packages; add additional prefixes like /usr/local here
PREFIXES = [sys.prefix, sys.exec_prefix]
# Enable per user site-packages directory
# set it to False to disable the feature or True to force the feature
ENABLE_USER_SITE = None

# for distutils.commands.install
# These values are initialized by the getuserbase() and getusersitepackages()
# functions, through the main() function when Python starts.
USER_SITE = None
USER_BASE = None

Where we will need to revise

USER_SITE = "D:\python\Python37\Lib\site-packages"
USER_BASE = "D:\python"

After saving we'll call the next command above

python -m site

This time we will find that the default path has been modified.
Then after I downloaded the library when you use the following command

python -m pip install -U flask --user

It will have a warning out, but is negligible, the file has entered a new path and download a success!

Released five original articles · won praise 3 · views 95

Guess you like

Origin blog.csdn.net/weixin_42887211/article/details/105368946