python教程—重要提示:ubuntu 14.04中没有名为_io的模块-Python实用宝典

python教程—重要提示:ubuntu 14.04中没有名为_io的模块

我刚刚安装了ubuntu 14.04LTS,我试图使用pip,但我得到了以下回溯:

我刚刚安装了ubuntu 14.04LTS,我试图使用pip,但我得到了以下回溯:

    (nlmanagement)psychok7@Ultrabook:~/code/work/nlmanagement$ pip freeze Traceback (most recent call last): File "/home/psychok7/code/work/venv/nlmanagement/bin/pip", line 9, in <module> load_entry_point('pip==1.1', 'console_scripts', 'pip')() File "/home/psychok7/code/work/venv/nlmanagement/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 337, in load_entry_point return get_distribution(dist).load_entry_point(group, name) File "/home/psychok7/code/work/venv/nlmanagement/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 2279, in load_entry_point return ep.load() File "/home/psychok7/code/work/venv/nlmanagement/local/lib/python2.7/site-packages/distribute-0.6.24-py2.7.egg/pkg_resources.py", line 1989, in load entry = __import__(self.module_name, globals(),globals(), ['__name__']) File "/home/psychok7/code/work/venv/nlmanagement/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/__init__.py", line 10, in <module> from pip.backwardcompat import walk_packages, console_to_str File "/home/psychok7/code/work/venv/nlmanagement/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/backwardcompat.py", line 77, in <module> from urllib2 import URLError, HTTPError File "/usr/lib/python2.7/urllib2.py", line 94, in <module> import httplib File "/usr/lib/python2.7/httplib.py", line 79, in <module> import mimetools File "/usr/lib/python2.7/mimetools.py", line 6, in <module> import tempfile File "/usr/lib/python2.7/tempfile.py", line 32, in <module> import io as _io File "/usr/lib/python2.7/io.py", line 51, in <module> import _io ImportError: No module named _io

有什么想法?我已经尝试了sudo apt-get install python3-pip和sudo apt-get install pythonpip

回答

您的virtualenv由于Python系统中的差异而损坏。

最佳选择是重新安装virtualenv:

    $ deactivate $ rmvirtualenv nlmanagement $ mkvirtualenv nlmanagement $ pip install -r requirements.txt

​Python实用宝典 (pythondict.com)
不只是一个宝典
欢迎关注公众号:Python实用宝典

本文由 Python实用宝典 作者:Python实用宝典 发表,其版权均为 Python实用宝典 所有,文章内容系作者个人观点,不代表 Python实用宝典 对观点赞同或支持。如需转载,请注明文章来源。
0

发表评论