centos 如何安装pip for python 2.7?

yhived7q  于 2022-11-07  发布在  Python
关注(0)|答案(4)|浏览(266)

我按照链接@ https://linuxize.com/post/how-to-install-pip-on-centos-7/#2-install-pip安装pip,但是它是为系统附带的python 2.6安装的,我如何为python 2.7安装它?

sudo yum install epel-release
Loaded plugins: security
Setting up Install Process
Package epel-release-6-8.noarch already installed and latest version
Nothing to do

安装管

sudo yum install python-pip
Loaded plugins: security
Setting up Install Process
Package python-pip-7.1.0-1.el6.noarch already installed and latest version
Nothing to do

pip版本

pip --version
pip 7.1.0 from /usr/lib/python2.6/site-packages (python 2.6)

机器配置:

LSB Version:    :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: OracleServer
Description:    Oracle Linux Server release 6.6
Release:    6.6
Codename:   n/a

/usr/本机

bxgwgixi

bxgwgixi1#

尝试手动安装:

wget -P ~/.local/lib https://bootstrap.pypa.io/pip/2.7/get-pip.py
python2.7 ~/.local/lib/get-pip.py --user 

# if using bash

printf "\nPATH=\$PATH:~/.local/bin/" >> ~/.bashrc
source ~/.bashrc
fcg9iug3

fcg9iug32#

pip已经放弃了对python 2.7的支持。如果你仍然想在python 2.7中使用它,那么降低pip的级别将有助于你:

sudo easy_install pip==20.3.4
rqdpfwrv

rqdpfwrv3#

在Ubuntu 20.04等较新版本中,python-pip不再是一个包。因此,旧的:

sudo apt install python-pip

必败无疑。
以下是解决此问题的方法:

curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
python get-pip.py

链接:https://www.how2shout.com/linux/how-to-install-python-2-7-on-ubuntu-20-04-lts-linux/

sgtfey8w

sgtfey8w4#

只需进入终端并输入:

sudo apt-get install python-pip

我知道这至少对乌藨子派有效。

相关问题