virtualenv不会对python 2.7进行符号链接warnings.py

前端之家收集整理的这篇文章主要介绍了virtualenv不会对python 2.7进行符号链接warnings.py前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

我在使用Lucid上的python2.7创建virtualenv(1.5.2)时遇到问题.看起来像virtualenv正在跳过warnings.py的symlink创建.

Running virtualenv with interpreter /usr/local/bin/python2.7
Creating test/lib/python2.7
Symlinking Python bootstrap modules
  Symlinking test/lib/python2.7/sre_compile.pyc
  Symlinking test/lib/python2.7/encodings
  Symlinking test/lib/python2.7/UserDict.pyc
  Symlinking test/lib/python2.7/stat.pyo
  Symlinking test/lib/python2.7/copy_reg.pyo
  Symlinking test/lib/python2.7/posixpath.py
  Symlinking test/lib/python2.7/stat.pyc
  Symlinking test/lib/python2.7/re.py
  Symlinking test/lib/python2.7/sre_parse.pyo
  Symlinking test/lib/python2.7/sre_constants.pyo
  Symlinking test/lib/python2.7/codecs.py
  Symlinking test/lib/python2.7/lib-dynload
  Symlinking test/lib/python2.7/locale.py
  Symlinking test/lib/python2.7/sre.pyc
  Symlinking test/lib/python2.7/ntpath.pyo
  Symlinking test/lib/python2.7/types.pyo
  Symlinking test/lib/python2.7/config
  Symlinking test/lib/python2.7/sre_parse.py
  Symlinking test/lib/python2.7/genericpath.pyc
  Symlinking test/lib/python2.7/sre.py
  Symlinking test/lib/python2.7/copy_reg.pyc
  Symlinking test/lib/python2.7/sre.pyo
  Symlinking test/lib/python2.7/sre_constants.py
  Symlinking test/lib/python2.7/types.pyc
  Symlinking test/lib/python2.7/UserDict.pyo
  Symlinking test/lib/python2.7/ntpath.pyc
  Symlinking test/lib/python2.7/fnmatch.py
  Symlinking test/lib/python2.7/os.pyo
  Symlinking test/lib/python2.7/codecs.pyo
  Symlinking test/lib/python2.7/os.pyc
  Symlinking test/lib/python2.7/fnmatch.pyo
  Symlinking test/lib/python2.7/genericpath.pyo
  Symlinking test/lib/python2.7/UserDict.py
  Symlinking test/lib/python2.7/re.pyc
  Symlinking test/lib/python2.7/genericpath.py
  Symlinking test/lib/python2.7/fnmatch.pyc
  Symlinking test/lib/python2.7/sre_compile.pyo
  Symlinking test/lib/python2.7/posixpath.pyc
  Symlinking test/lib/python2.7/os.py
  Symlinking test/lib/python2.7/re.pyo
  Symlinking test/lib/python2.7/sre_parse.pyc
  Symlinking test/lib/python2.7/types.py
  Symlinking test/lib/python2.7/sre_compile.py
  Symlinking test/lib/python2.7/sre_constants.pyc
  Symlinking test/lib/python2.7/copy_reg.py
  Symlinking test/lib/python2.7/posixpath.pyo
  Symlinking test/lib/python2.7/locale.pyc
  Symlinking test/lib/python2.7/locale.pyo
  Symlinking test/lib/python2.7/codecs.pyc
  Symlinking test/lib/python2.7/ntpath.py
  Symlinking test/lib/python2.7/stat.py
Creating test/lib/python2.7/site-packages
Writing test/lib/python2.7/site.py
Writing test/lib/python2.7/orig-prefix.txt
Creating parent directories for test/include
Symlinking test/include/python2.7
Creating test/bin
New python executable in test/bin/python2.7
Changed mode of test/bin/python2.7 to 0755
Also creating executable in test/bin/python
Changed mode of test/bin/python to 0755
Testing executable with test/bin/python2.7 -c "import sys; print sys.prefix"
Traceback (most recent call last):
  File "/home/marek/projects/workspace/test/lib/python2.7/site.py",line 67,in 

文件warnings.py位于/usr/local/lib/python2.7/中.

使用python2.6创建virtualenv没有问题.

最佳答案
所以我检查了virtualenv.py代码,它有一个列表required_MODULES,它似乎有新的环境的/ lib目录中附加模块的名称.在满足条件后,此列表由模块“警告”扩展:

sys.version_info[:2] >= (2,6)

正确识别了python的版本,因此virtualenv.py没有问题.要指定我使用已安装的virtualenv,而不是文件virtualenv.py.

从python dist-packages中删除文件virtualenv.pyc后,问题就消失了.所以看起来像编译的virtualenv文件有问题 – 看起来像pythons版本检查的问题.

原文链接:https://www.f2er.com/python/439119.html

猜你在找的Python相关文章