【问题标题】:how to install pip for python 2.7?如何为 python 2.7 安装 pip?
【发布时间】:2019-06-13 20:02:32
【问题描述】:

我按照链接@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/本地

【问题讨论】:

  • 以上都没有解决我的问题...就像我说的使用 OracleServer 6.6
  • 接受的答案无处不在,Linux、w32、MacOS……
  • @phd 这给了我一个错误$ python get-pip.py pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available. Collecting pip .. Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping Could not find a version that satisfies the requirement pip (from versions: ) No matching distribution found for pip

标签: python pip centos


【解决方案1】:

尝试手动安装:

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

【讨论】:

  • 这在第 2 步失败,错误为 Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.",)) - skipping Could not find a version that satisfies the requirement pip (from versions: ) No matching distribution found for pip
  • 如何摆脱这个 SSL 错误?这一直是我的障碍
  • 你自己编译过python吗?你有 OpenSSL 吗?见 fx stackoverflow.com/questions/44290926/…
  • 不,我没有自己编译python...我似乎无法在/usr/local下找到python源,我如何找到源?
  • 已更新为:bootstrap.pypa.io/pip/2.7/get-pip.py。您帖子中的网址现在仅适用于 Python3
【解决方案2】:

pip 已放弃对 python 2.7 的支持。如果您仍想将它用于 python 2.7,降级 pip 将帮助您:

sudo easy_install pip==20.3.4

【讨论】:

    【解决方案3】:

    只需进入终端并输入:

    sudo apt-get install python-pip
    

    我知道这至少适用于树莓派。

    【讨论】:

      猜你喜欢
      • 2021-06-04
      • 2011-10-19
      • 2023-03-21
      • 2014-12-22
      • 2018-03-15
      • 2017-11-06
      • 2022-06-10
      • 1970-01-01
      • 2016-08-05
      相关资源
      最近更新 更多