6
ubuntu 20.04 安装 pip2
source link: https://www.wyr.me/post/678
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
在ubuntu 20.04 LTS版本中,可以通过sudo apt install python
安装python2,但是无法通过sudo apt install python-pip
安装pip2,提示E: Unable to locate package python-pip
。
无法找到python-pip安装包的原因是,Python 2.7的支持周期已于2020年1月1日结束。因为不再维护Python 2.7,pip 21.0已于2021年1月停止对Python 2.7的支持。
如果通过pypa.io
的默认get-pip.py
脚本进行安装,也将遇到This script does not work on Python 2.7 The minimum supported Python version is 3.6.
提示。
正确的安装姿势
sudo apt install wget python-is-python2 # 安装wget和python2
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
重启终端后,即可执行pip
或pip2
命令。
此安装方法同样适用于WSL2。
Ubuntu 20.04 LTS安装python2和python3以及对应pip
复制下面的命令,可快速完成python2和python3以及对应pip的安装。
sudo apt install wget python python3 python3-pip python-ply python3-ply -y
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
记得重启终端。
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK