安装 pip for python2.7 时出错

安装 pip for python2.7 时出错

我已经在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 

相关内容