python2.7安裝pip時出錯

python2.7安裝pip時出錯

我已經在Linux上安裝了python2.7,我想安裝在下面/path/to/python2.7.9/bin。所以我這樣做了:

> cd /path/to/setuptools-16.0
> /path/to/python2.7.9/bin/python setup.py install
> cd /path/to/pip-7.0.0
> /path/to/python2.7.9/bin/python setup.py install

然後安裝在/path/to/python2.7.9/bin.但當我執行時/path/to/python2.7.9/bin/pip,它顯示:

> ~/local/python-2.7.9/bin/pip
Traceback (most recent call last):
  File "/root/local/python-2.7.9/bin/pip", line 9, in <module>
    load_entry_point('pip==7.0.0', 'console_scripts', 'pip')()
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 345, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2381, in load_entry_point
    return ep.load()
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/distribute-0.6.49-py2.7.egg/pkg_resources.py", line 2087, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/__init__.py", line 15, in <module>
    from pip.vcs import git, mercurial, subversion, bazaar  # noqa
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/vcs/subversion.py", line 9, in <module>
    from pip.index import Link
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/index.py", line 30, in <module>
    from pip.wheel import Wheel, wheel_ext
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/wheel.py", line 34, in <module>
    from pip._vendor.distlib.scripts import ScriptMaker
  File "/root/local/python-2.7.9/lib/python2.7/site-packages/pip-7.0.0-py2.7.egg/pip/_vendor/__init__.py", line 92, in load_module
    raise ImportError("No module named '%s'" % (name,))
ImportError: No module named 'pip._vendor.distlib.scripts'

我嘗試安裝很多軟體包,例如散佈,腳本。但沒有幫助。

我不知道出了什麼問題。你能幫助我嗎?謝謝。

答案1

我遇到了同樣的問題,可以透過新增 libssl-dev 套件來解決它。在基於 Debian 的發行版上,您可以透過 apt-get 安裝該軟體包:

$ apt-get update && apt-get -y install libssl-dev

更新: 如果 libssl-dev 軟體包不適用於您的發行版,您可以使用 openssl-dev 軟體包。以 Alpine Linux 為例:

$ apk --update add openssl-dev 

相關內容