python-pip安装及错误合集

 1.命令安装:yum install python-pip

错误一:

提示No package python-pip available.Error: Nothing to do EPEL (Extra Packages for Enterprise Linux,企业版Linux的额外软件包) 是Fedora小组维护的一个软件仓库项目,为RHEL/CentOS提供他们默认不提供的软件包。

解决:

epel是社区强烈打造的免费开源发行软件包版本库。

是为企业级Linux提供的一组高质量的额外软件包

自动安装:yum -y install epel-release

 rpm安装:rpm -ivh http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm

1、 要安装最新版本的EPEL,请前往 Index of /epel/ 中查找最新版本的URL地址,这里采用的是6.8版本

32位:http://mirrors.ustc.edu.cn/fedora/epel/6/i386/epel-release-6-8.noarch.rpm

64位:http://mirrors.ustc.edu.cn/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm

(1)查看安装的版本

[root@controller ~]# rpm -q epel-release

epel-release-7-11.noarch

(2)查看其所依附的软件文件

[root@controller ~]# rpm -qR epel-release

config(epel-release) = 7-11

redhat-release >= 7

rpmlib(CompressedFileNames) <= 3.0.4-1

rpmlib(FileDigests) <= 4.6.0-1

rpmlib(PayloadFilesHavePrefix) <= 4.0-1

rpmlib(PayloadIsXz) <= 5.2-1

(3)卸载

[root@controller ~]# rpm -e epel-release

错误二:

python -m pip install --upgrade pip

版本跨越过大:(低版本无法直接跨越高版本)

​
Collecting pip

  Using cached https://files.pythonhosted.org/packages/52/e1/06c018197d8151383f66ebf6979d951995cf495629fc54149491f5d157d0/pip-21.2.4.tar.gz

    Complete output from command python setup.py egg_info:

    Traceback (most recent call last):

      File "<string>", line 1, in <module>

      File "c:\users\tzzha\appdata\local\temp\pip-build-nzbfrv\pip\setup.py", line 7

        def read(rel_path: str) -> str:

                         ^

    SyntaxError: invalid syntax

Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-OL7esQ/pip/

You are using pip version 8.1.2, however version 22.3.1 is available.

You should consider upgrading via the 'pip install --upgrade pip' command

​

python -m pip 指示python的python解释器来执行pip

错误三:

pip下载文件时的错误

python2.7不对pip21.X支持

​
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade
 your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 
2.7 in January 2021. More details about Python 2 support in pip can be found at Release 
process - pip documentation v23.0.dev0 pip 21.0 will remove support for this functionality.

​

解决:

下载pip20版本:

下载链接:https://pypi.org/project/pip/20.2.4/#files

进入pip-20.2  -->  目录

安装python setup.py install

错误 

 

解决: 

 yum install wget

wget https://pypi.python.org/packages/source/s/setuptools/setuptools-2.0.tar.gz --no-check-certificate 

进入setuptools-2.0 -->  目录

python setup.py build
python setup.py install

对不起,我给出的解决方法中包含了错误的信息。在 Ubuntu 上安装 Python 包管理工具 pip,您可以执行以下命令: ```shell sudo apt update sudo apt install python-pip ``` 如果出现 "软件包 python-pip 没有可安装候选" 的错误,可能是由于软件包源配置错误或网络问题导致无法找到软件包。您可以尝试修改软件包源并再次尝试安装 pip。 首先,备份您当前的软件包源列表: ```shell sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup ``` 然后,使用文本编辑器打开软件包源列表文件: ```shell sudo nano /etc/apt/sources.list ``` 在文件中,注释掉原有的软件包源地址,并添加以下软件包源地址(根据您的 Ubuntu 版本选择合适的源): 对于 Ubuntu 20.04: ```shell deb http://archive.ubuntu.com/ubuntu focal main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu focal-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu focal-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu focal-security main restricted universe multiverse ``` 对于 Ubuntu 18.04: ```shell deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse ``` 保存文件后,执行以下命令更新软件包列表并安装 python-pip: ```shell sudo apt update sudo apt install python-pip ``` 这样应该能够成功安装 python-pip。如果问题仍然存在,请提供更多详细信息,以便我能更好地帮助您解决问题。
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值