python pip
查看pip 版本:pip --version
root@heihei:~# pip --version
pip 9.0.1 from /usr/lib/python2.7/dist-packages (python 2.7)
查看已安装的python库: pip list
root@heihei:~# pip list
kiwisolver (1.1.0)
matplotlib (2.2.5)
networkx (2.2)
numpy (1.16.6)
openpyxl (2.6.4)
................
卸载python库:pip uninstall openpyxl
root@heihei:~# pip uninstall openpyxl
Uninstalling openpyxl-2.6.4:
............................
Proceed (y/n)? y
Successfully uninstalled openpyxl-2.6.4
安装python库:pip install openpyxl
root@heihei:~# pip install openpyxl
Collecting openpyxl
Requirement already satisfied: et-xmlfile in /usr/local/lib/python2.7/dist-packages (from openpyxl)
Requirement already satisfied: jdcal in /usr/local/lib/python2.7/dist-packages (from openpyxl)
Installing collected packages: openpyxl
Successfully installed openpyxl-2.6.4
更新python pip版本:python -m pip install --upgrade pip
root@heihei:~# python -m pip install --upgrade pip
Cache entry deserialization failed, entry ignored
Collecting pip
Downloading https://files.pythonhosted.org/packages/27/79/8a850fe3496446ff0d584327ae44e7500daf6764ca1a382d2d02789accf7/pip-20.3.4-py2.py3-none-any.whl (1.5MB)
100% |################################| 1.5MB 676kB/s
Installing collected packages: pip
Found existing installation: pip 9.0.1
Not uninstalling pip at /usr/lib/python2.7/dist-packages, outside environment /usr
Successfully installed pip-20.3.4
假如如此更新后 pip install 库的时候还是有异常报错,或者pip自己本身出错了
可以用下面这种方法进行更新,直接从官网拉取 get-pip.py安装
root@heihei:~# wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
root@heihei:~# python2 get-pip.py