Query all installation packages
pip show
Query the installation information of the specified package
pip show -f PackageName
List installed packages
pip list
Check out upgradeable packages
pip list -o
Upgrade package
Upgrade the specified package , By using ==, >=, <=, >, < To specify a version number .
pip install --upgrade PackageName
upgrade pip
pip install -U pip
Uninstall package
pip uninstall PackageName
Search package
2020 year 12 Monthly this function is disabled , Because someone wrote the wrong code ? Or on purpose , Cause the back end of this function to crash , I don't know whether it has been repaired or not .
pip search PackageName
If two versions of Python, Use pip matters needing attention
python2 -m pip install XXX
python3 -m pip install XXX
Use the mirror site code
pip install -i http://pypi.douban.com/simple --trusted-host pypi.douban.com packagename
# packagename Is the name of the package to download
pip install -i http://e.pypi.python.org --trusted-host e.pypi.python.org --upgrade pip
# upgrade pip
Including temporary and permanent use
With the additional mirror command , You can set multiple images to use . See the code below for details :
# Temporary use
pip install -i https://mirrors.aliyun.com/pypi/simple/ Package name
# Permanent change ( Take Alibaba cloud image as an example )
# Add a primary image as a common source
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/
# Add an additional image as an alternate image source , When the resource is not found in the primary image , Use an alternate mirror address
pip config set global.extra-index-url https://pypi.tuna.tsinghua.edu.cn/simple
# Check the settings
pip config list
# Cancel settings
pip config unset global.index-url
# export file
pip freeze > requirements.txt
# Installation environment information
pip install -r requirements.txt
1. A warning message appears
The warning diagram as shown in the figure below appears :
terms of settlement :
Find the directory with the error in the warning message , And then delete ~ Folders at the beginning , Before that, the plug-in failed to install / Drop out , The plug-in installation is abnormal , Although the warning does not affect , But I have obsessive-compulsive disorder ha-ha . Just delete the folder :
The cause of the problem :
My previous updates pip When the package , Open... Without administrator privileges cmd, Cause installation to fail , So this is more .
2. to update pip problem
Use the administrator to use the above update pip On command , Note the following error .
Traceback (most recent call last):
File "d:\python\lib\runpy.py", line 197, in _run_module_as_main
return _run_code(code, main_globals, None,
File "d:\python\lib\runpy.py", line 87, in _run_code
exec(code, run_globals)
File "D:\Python\Scripts\pip.exe\__main__.py", line 4, in <module>
ModuleNotFoundError: No module named 'pip'
terms of settlement :
Use the following commands in turn , Can solve .
python -m ensurepip
python -m pip install --upgrade pip