问题描述
我想检查在我的虚拟环境下运行的是哪个 Python 解释器,所以我刚刚进入了 virtualenv 并使用了 getsitepackages.这是出来的.
I wanted to check out which Python interpreter was running under my virtual env so I just entered the virtualenv and used getsitepackages. This is what came out.
(test)~/Documents/Development/test$ python
Python 2.7.9 (default, Apr 7 2015, 07:58:25)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import site
>>> print site.getsitepackages()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: 'module' object has no attribute 'getsitepackages'
>>>
这是在 virtualenv 下运行时的正常行为吗?如果可能的话,我将如何纠正,或者我什至应该打扰?
Is this normal behaviour when operating under a virtualenv? If possible how would I correct, or should I even bother?
推荐答案
一个用户拥有 和你一样的问题.
有一个已知错误,Python 2.7 与 site.py 不兼容
.自 2012 年 11 月以来,此错误仍然存在.
There is a known bug, that Python 2.7 isn't compatible with site.py
. This bug is still open, since November 2012.
您必须离开 virtualenv 或使用其他版本的 Python.
You have to leave virtualenv or use another version of Python.
这篇关于virtualenv 下 getsitepackages 的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!