程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

python-pip

編輯:Python

Check to see if... Is already installed pip 

pip --version
pip --version # Python2.x Version command
pip3 --version # Python3.x Version command 

If you haven't already installed , You can use the following methods to install :

$ curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py # Download the installation script
$ sudo python get-pip.py # Run the installation script
Be careful : Which version of Python Run the installation script ,pip It's related to which version , If it is Python3 Then execute the following command :
$ sudo python3 get-pip.py # Run the installation script .
General situation pip The corresponding is Python 2.7,pip3 The corresponding is Python 3.x.
part Linux The distribution can be installed directly with the package manager pip, Such as Debian and Ubuntu:
sudo apt-get install python-pip

View the packages we have installed

pip list

see Mirror address

$ pip3 config list
global.index-url='https://pypi.tuna.tsinghua.edu.cn/simple'
install.trusted-host='https://pypi.tuna.tsinghua.edu.cn'

pip upgrade

pip install -U pip
If there is a problem with this upgrade command , You can use the following command :
sudo easy_install --upgrade pip
python -m pip install --upgrade pip

If you encounter :

C:\Users\Admin>python -m pip install --upgrade pip
D:\LDS\environment\python\python.exe: No module named pip

be :

1、python -m ensurepip
2、python -m pip install --upgrade pip

C:\Users\Admin>python -m pip install --upgrade pip
D:\LDS\environment\python\python.exe: No module named pip
C:\Users\Admin>python -m ensurepip
Looking in links: c:\Users\Admin\AppData\Local\Temp\tmpvph2bg2c
Requirement already satisfied: setuptools in d:\lds\environment\python\lib\site-packages (49.2.1)
Processing c:\users\admin\appdata\local\temp\tmpvph2bg2c\pip-20.2.3-py2.py3-none-any.whl
Installing collected packages: pip
Successfully installed pip-20.2.3
C:\Users\Admin>
C:\Users\Admin>python -m pip install --upgrade pip
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pip
Using cached https://pypi.tuna.tsinghua.edu.cn/packages/6a/df/a6ef77a6574781a668791419ffe366c8acd1c3cf4709d210cb53cd5ce1c2/pip-22.0.3-py3-none-any.whl (2.1 MB)
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 20.2.3
Uninstalling pip-20.2.3:
Successfully uninstalled pip-20.2.3
Successfully installed pip-22.0.3
C:\Users\Admin>

Linux or macOS 

pip install --upgrade pip # python2.x
pip3 install --upgrade pip # python3.x

Windows Platform upgrade : 

python -m pip install -U pip # python2.x
python -m pip3 install -U pip # python3.x

Check out upgradeable packages

pip list -o

Upgrade package

pip install --upgrade SomePackage
# Upgrade the specified package , By using ==, >=, <=, >, < To specify a version number .

Search package

pip search SomePackage

Show installation package information

pip show 

View the details of the specified package  

pip show -f SomePackage

Installation package

pip install some-package-name
pip install SomePackage # The latest version
pip install SomePackage==1.0.4 # Specify the version
pip install 'SomePackage>=1.0.4' # Minimum version 
pip install pymysql -i http://pypi.douban.com/simple --trusted-host pypi.douban.com
python -m pip install frida==12.8.0 // Don't use it directly pip install
python -m pip install frida-tools==5.3.0 // Don't use it directly pip install 

 

Uninstall package

pip uninstall some-package-name

pip Tsinghua University open source software image station

Temporary use  

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

If you want to set it as the default, you need to upgrade pip To the latest version (>=10.0.0) Then configure

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

If you come to pip The default source has a poor network connection , Temporarily use this image station to upgrade pip

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

If due to some LAN reasons , Use pip appear “connection timeout”, When the connection times out, you can use the domestic mirror website to download :

  douban :https://pypi.doubanio.com/simple/

  tsinghua :https://pypi.tuna.tsinghua.edu.cn/simple

Alibaba cloud  Simple Index
University of science and technology of China  https://pypi.mirrors.ustc.edu.cn/simple/ 
douban (douban) Simple Index 
Tsinghua University  Simple Index
University of science and technology of China  Simple Index

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

If Python2 and Python3 At the same time there is pip, The usage is as follows

Python2:

python2 -m pip install XXX

Python3:

python3 -m pip install XXX


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved