virtualenv警告:“与系统位置相同......”

时间:2012-10-26 16:10:23

标签: python virtualenv

当我尝试导入distutils或使用mercurial或其他各种python代码时,我收到以下警告:

$ ~/virtual-python/bin/python -c "import distutils; print distutils.__file__"
/Users/adam/virtual-python/lib/python2.7/distutils/__init__.py:13: UserWarning: The virtualenv distutils package at %s appears to be in the same location as the system distutils?
  "The virtualenv distutils package at %s appears to be in the same location as the system distutils?")
/Users/adam/virtual-python/lib/python2.7/distutils/__init__.pyc

这是什么意思?我希望系统distutils不在我的virtualenv目录中,但似乎是警告所说的。

系统用户安装的python包含在我的sys.path中:
/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7(和子目录) 我怀疑是问题的原因,但我不确定。

警告不会阻止任何工作,但我宁愿有一个真正的解决方案,而不是每次调用带有-W标志的python("putting electrical tape over the warning light"

1 个答案:

答案 0 :(得分:1)

这是一个愚蠢的答案和错误的方法,但我收到了这个错误:

/Users/adam/virtual-python/lib/python2.7/distutils/__init__.py:13: UserWarning: The virtualenv distutils package at %s appears to be in the same location as the system distutils? "The virtualenv distutils package at %s appears to be in the same location as the system distutils?")

所以我刚从该文件中删除了第13行。愚蠢,但有效。警告灯已移除。不过,我更愿意接受一个真实的答案。