【问题标题】:issues with getsitepackages under a virtualenvvirtualenv 下的 getsitepackages 问题
【发布时间】:2015-04-27 06:09:55
【问题描述】:

我想检查在我的虚拟环境下运行的是哪个 Python 解释器,所以我只是进入了虚拟环境并使用了 getsitepackages。就这样出来了。

(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 下操作时这是正常行为吗?如果可能的话,我将如何纠正,或者我什至应该打扰?

【问题讨论】:

    标签: python terminal virtualenv


    【解决方案1】:

    用户拥有same problem as you。

    有一个已知的错误,即Python 2.7 isn't compatible with site.py。 自 2012 年 11 月以来,此错误仍然存​​在。

    您必须离开 virtualenv 或使用其他版本的 Python。

    【讨论】:

    • 3 年没有修复?哎呀...如果我使用 Python3,这个问题是否仍然存在?
    猜你喜欢
    • 2023-04-07
    • 1970-01-01
    • 2011-05-30
    • 2010-11-03
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多