1

当我尝试以下命令时

pip install requests

我收到以下错误

Traceback (most recent call last):
  File "/usr/bin/pip", line 9, in <module>
    load_entry_point('pip==1.4.1', 'console_scripts', 'pip')()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 343, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2307, in load_entry_point
    return ep.load()
  File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 2013, in load
    entry = __import__(self.module_name, globals(),globals(), ['__name__'])
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/__init__.py", line 10, in <module>
    from pip.util import get_installed_distributions, get_prog
  File "/usr/lib/python2.7/site-packages/pip-1.4.1-py2.7.egg/pip/util.py", line 8, in <module>
    import zipfile
  File "/usr/lib/python2.7/zipfile.py", line 6, in <module>
    import io
  File "/usr/lib/python2.7/io.py", line 60, in <module>
    import _io
ImportError: No module named _io

但是当我尝试env使用以下命令检查时

env python

我可以看到它仅从 python 2.7 运行

Python 2.7.3 (default, Dec 18 2012, 13:50:09)
[GCC 4.5.3] on cygwin
Type "help", "copyright", "credits" or "license" for more information.

所以在交互式命令行中我尝试了以下

>>> import _io
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named _io
4

2 回答 2

0

这可能是因为您的防病毒程序已删除io.py。我只需要python在 cygwin 上重新安装并尝试在关闭防病毒软件的情况下安装程序。我以这种方式成功安装request

于 2013-09-20T23:53:10.567 回答
0

您的 pip 已损坏或与两个软件包安装 easy_install vs pip 发生冲突。

1) 使用 easy_install pip 升级或重新安装

将解决问题,如果您的虚拟环境因 14.04 升级而出现其他问题,请查看此处的问题。类似的stackoverflow问题

于 2014-05-02T14:23:00.887 回答