issues with getsitepackages under a virtualenv

此生再无相见时 提交于 2019-12-24 03:52:51

问题


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'
>>>

Is this normal behaviour when operating under a virtualenv? If possible how would I correct, or should I even bother?


回答1:


A user has the same problem as you.

There is a known bug, that Python 2.7 isn't compatible with site.py. This bug is still open, since November 2012.

You have to leave virtualenv or use another version of Python.



来源:https://stackoverflow.com/questions/29888373/issues-with-getsitepackages-under-a-virtualenv

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!