pip install virtualenv,在 ubuntu 15.04 上出错

pip install virtualenv,在 ubuntu 15.04 上出错

如何修复此问题?以及如何在 ubuntu 15.04 上安装 pip 和 virtualenv

 pip install virtualenv
    Traceback (most recent call last):
      File "/usr/bin/pip", line 9, in <module>
        load_entry_point('pip==1.5.6', 'console_scripts', 'pip')()
      File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 521, in load_entry_point
        return get_distribution(dist).load_entry_point(group, name)
      File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2632, in load_entry_point
        return ep.load()
      File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2312, in load
        return self.resolve()
      File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 2318, in resolve
        module = __import__(self.module_name, fromlist=['__name__'], level=0)
      File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 74, in <module>
        from pip.vcs import git, mercurial, subversion, bazaar  # noqa
      File "/usr/lib/python2.7/dist-packages/pip/vcs/mercurial.py", line 9, in <module>
        from pip.download import path_to_url
      File "/usr/lib/python2.7/dist-packages/pip/download.py", line 25, in <module>
        from requests.compat import IncompleteRead
    ImportError: cannot import name IncompleteRead

答案1

您最近是否安装了最新版本的 python-package requests

该版本pip与 Ubuntu 附带的旧版本不兼容!

您需要重新安装当前的版本pip,一切都会好起来:

sudo easy_install pip

或者如果你在使用 Python3 时遇到这些问题:

sudo easy_install3 pip

您应该始终使您的 Python 包与 PyPI 的当前版本保持同步(使用pip或其祖先easy_installwhilepip已损坏)而不是使用apt-get,因为 Ubuntu 存储库几乎落后于最新技术。

用于sudo pip install --upgrade INSERTNAMEOFPYTHONPACKAGEHERE您使用的每个包以获取最新的环境。

相关内容