Ubuntu安装pip
目录
一、python2.7安装pip
我下载的ubuntu自带python3.6 和python3.7,可以在/usr/lib目录下查看到。
安装python2.7 版本
apt-get install python
进入python2.7的目录下
cd /usr/local/python2.7
下载get-pip.py文件
wget https://bootstrap.pypa.io/get-pip.py
安装pip
sudo python get-pip.py
判断是否安装成功
pip --version
显示内容:
pip 19.3.1 from /usr/local/lib/python2.7/dist-packages/pip (python 2.7)
二、python3.6安装pip
python3.6尝试了一下安装,报下面的错误。
root@DESKTOP-FVUJUND:/usr/lib/python3.6# sudo python3 get-pip.py
Traceback (most recent call last):
File "get-pip.py", line 22318, in <module>
main()
File "get-pip.py", line 198, in main
bootstrap(tmpdir=tmpdir)
File "get-pip.py", line 82, in bootstrap
import pip._internal.main
File "/tmp/tmp3w0za0zl/pip.zip/pip/_internal/main.py", line 13, in <module>
File "/tmp/tmp3w0za0zl/pip.zip/pip/_internal/cli/autocompletion.py", line 11, in <module>
File "/tmp/tmp3w0za0zl/pip.zip/pip/_internal/cli/main_parser.py", line 7, in <module>
File "/tmp/tmp3w0za0zl/pip.zip/pip/_internal/cli/cmdoptions.py", line 19, in <module>
ModuleNotFoundError: No module named 'distutils.util'
查看一个博客说安装distutils就成功了,参考:http://www.bubuko.com/infodetail-3063916.html
也可以这样尝试:
sudo apt-get install python3-pip
pip --version
来源:CSDN
作者:韩师学子--胖佳
链接:https://blog.csdn.net/xiao__jia__jia/article/details/103745868