【问题标题】:Where is pip in Python 2.7.9 (Linux)Python 2.7.9 (Linux) 中的 pip 在哪里
【发布时间】:2015-02-26 19:53:53
【问题描述】:

我意识到这个问题可能真的很愚蠢,但我一生都无法弄清楚在安装 python 2.7.9 时在哪里可以找到 pip。我知道这个版本及以上版本捆绑了pip,但还是找不到。我没有常规的写权限,也没有包管理器,所以我通过从他们的网站下载 linux 二进制文件来安装 Python 2.7.9,然后

./configure --prefix=/home/me/software/python-2.7.9/myinstall/

然后

make; make install

一切似乎都正常工作,我可以在以这种方式安装后运行 python,但 pip 无处可寻。任何帮助将不胜感激。

更新

运行 python get-pip.py 会产生以下错误消息:

ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Traceback (most recent call last):
  File "get-pip.py", line 20204, in <module>
    main()
  File "get-pip.py", line 152, in main
    bootstrap(tmpdir=tmpdir)
  File "get-pip.py", line 82, in bootstrap
    import pip
  File "/tmp/tmpGmhhtn/pip.zip/pip/__init__.py", line 15, in <module>
  File "/tmp/tmpGmhhtn/pip.zip/pip/vcs/mercurial.py", line 11, in <module>
  File "/tmp/tmpGmhhtn/pip.zip/pip/download.py", line 30, in <module>
  File "/tmp/tmpGmhhtn/pip.zip/pip/_vendor/__init__.py", line 81, in load_module
ImportError: No module named 'pip._vendor.requests'

(对不起,篇幅较长)。

更新 2

运行python -m ensurepip -vvv -U我得到这个错误:

ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha1
ERROR:root:code for hash sha224 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha224
ERROR:root:code for hash sha256 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha256
ERROR:root:code for hash sha384 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha384
ERROR:root:code for hash sha512 was not found.
Traceback (most recent call last):
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 147, in <module>
    globals()[__func_name] = __get_hash(__func_name)
  File "/home/me/software/Python-2.7.9/_centos5/lib/python2.7/hashlib.py", line 97, in __get_builtin_constructor
    raise ValueError('unsupported hash type ' + name)
ValueError: unsupported hash type sha512
Ignoring ensurepip failure: pip 1.5.6 requires SSL/TLS

【问题讨论】:

  • which pip 输出什么?
  • /usr/bin/which: no pip in path/morepath...
  • 安装 pip 使用bootstrap.pypa.io/get-pip.pypython get-pip.py 安装使用你安装的python
  • find /home/me/software/python-2.7.9/myinstall/ -type f -name "pip*" 怎么样?
  • python -m pip install somepackage 工作吗?

标签: python linux pip


【解决方案1】:

您可能需要使用ensurepip 包。

python -m ensurepip

如果 pip 不存在,这将安装它。

【讨论】:

  • 这给了我ERROR:root:code for hash md5 was not found. Traceback (most recent call last):...
  • @E.Cross 在这种情况下,我只需安装pipbootstrap.pypa.io/get-pip.py。有关详细信息,请参阅pip.pypa.io/en/latest/installing.html
  • @E.Cross,这看起来像是一个 ssl 问题
  • 我确实读到过,虽然我不知道如何解决 ssl 问题。我不确定是否需要安装 openssl(这似乎适用于我有 centos5 的 solaris)
  • @E.Cross:如果你运行python -m ensurepip -vvv -U会发生什么?
【解决方案2】:

我遇到了同样的问题,但在 Windows 计算机上。通过右键单击并以管理员身份运行然后尝试以管理员身份重新打开命令提示符

python -m ensurepip

再次工作并成功安装了 pip,我现在也可以安装其他模块了。

【讨论】:

猜你喜欢
  • 2015-04-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-12-23
  • 2015-12-27
相关资源
最近更新 更多