在virtualenv下的Python 2.7:破坏了`site.py`
发布时间:2020-12-20 13:23:27 所属栏目:Python 来源:网络整理
导读:当我使用 Python 2.7创建一个新的virtualenv时,我无法使用site.getsitepackages(): $virtualenv testenv -p python2.7 --no-site-packagesRunning virtualenv with interpreter /usr/bin/python2.7New python executable in testenv/bin/python2.7Also crea
当我使用
Python 2.7创建一个新的virtualenv时,我无法使用site.getsitepackages():
$virtualenv testenv -p python2.7 --no-site-packages Running virtualenv with interpreter /usr/bin/python2.7 New python executable in testenv/bin/python2.7 Also creating executable in testenv/bin/python Installing setuptools............done. Installing pip...............done. $cd testenv/ $source bin/activate (testenv)$python Python 2.7.1+ (r271:86832,Apr 11 2011,18:05:24) [GCC 4.5.2] on linux2 Type "help","copyright","credits" or "license" for more information. >>> import site >>> site.getsitepackages() Traceback (most recent call last): File "<stdin>",line 1,in <module> AttributeError: 'module' object has no attribute 'getsitepackages' 似乎site.py没有Python 2.7中应该有的新功能. 有什么建议? 编辑:即使我不使用–no-site-packages问题仍然存在: $virtualenv testenv -p python2.7 Running virtualenv with interpreter /usr/bin/python2.7 New python executable in testenv/bin/python2.7 Also creating executable in testenv/bin/python Installing setuptools............done. Installing pip...............done. $cd testenv/ $source bin/activate (testenv)$python Python 2.7.1+ (r271:86832,in <module> AttributeError: 'module' object has no attribute 'getsitepackages' 解决方法
这是在virtualenv的更高版本中修复的错误.我搜索了门票,但我找不到合适的门票……
(编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |