开发者

virtualenv won't symlink warnings.py for python 2.7

开发者 https://www.devze.com 2023-02-17 14:49 出处:网络
I have a problem with creating virtualenv (1.5.2) with python2.7 on Lucid. It seems, like virtualenv is skipping creation of symlink for warnings.py.

I have a problem with creating virtualenv (1.5.2) with python2.7 on Lucid. It seems, like virtualenv is skipping creation of symlink for warnings.py.

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/pyt开发者_JAVA百科hon2.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 <module>
    import os
  File "/home/marek/projects/workspace/test/lib/python2.7/os.py", line 49, in <module>
    import posixpath as path
  File "/home/marek/projects/workspace/test/lib/python2.7/posixpath.py", line 17, in <module>
    import warnings
ImportError: No module named warnings
ERROR: The executable test/bin/python2.7 is not functioning
ERROR: It thinks sys.prefix is '/home/marek/projects/workspace' (should be '/home/marek/projects/workspace/test')
ERROR: virtualenv is not compatible with this system or executable

File warnings.py is in /usr/local/lib/python2.7/.

There is no problem for creating virtualenv with python2.6.


So I've checked virtualenv.py code and it has a list REQUIRED_MODULES, which seems to have names of modules to attach in /lib dir of new environment. This list is extended by module 'warnings' after satisfying a condition:

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

Version of python was correctly indentified, so there was no problem with virtualenv.py. To specify I was using installed virtualenv, not file virtualenv.py.

After removing file virtualenv.pyc from python dist-packages the problem is gone. So it seems, like something was wrong with compiled virtualenv file - looks like problem of pythons version checking.

0

精彩评论

暂无评论...
验证码 换一张
取 消