如何解决在ubuntu上使用python 2.7在virtualenv中创建沙箱失败?
| 为什么virtualenv抱怨缺少_weakrefset
laptop:~/sandbox$ virtualenv --python=/usr/bin/python2.7 --no-site-packages play
Running virtualenv with interpreter /usr/bin/python2.7
New python executable in play/bin/python2.7
Also creating executable in play/bin/python
Traceback (most recent call last):
File \"/home/ribery/sandbox/play/lib/python2.7/site.py\",line 67,in <module>
import os
File \"/home/ribery/sandbox/play/lib/python2.7/os.py\",line 398,in <module>
import UserDict
File \"/home/ribery/sandbox/play/lib/python2.7/UserDict.py\",line 83,in <module>
import _abcoll
File \"/home/ribery/sandbox/play/lib/python2.7/_abcoll.py\",line 11,in <module>
from abc import ABCMeta,abstractmethod
File \"/home/ribery/sandbox/play/lib/python2.7/abc.py\",line 8,in <module>
from _weakrefset import WeakSet
ImportError: No module named _weakrefset
ERROR: The executable django-py27/bin/python2.7 is not functioning
ERROR: It thinks sys.prefix is \'/home/ribery/sandbox\'
(should be \'/home/ribery/sandbox/play\')
ERROR: virtualenv is not compatible with this system or executable
解决方法
参见https://github.com/pypa/virtualenv/issues/76
要与Python 2.7一起使用,请将virtualenv升级到1.5.1或更高版本。您可以用
virtualenv --version
查看当前版本。
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。