2011-03-18 5 views
5

Tengo un problema al crear virtualenv (1.5.2) con python2.7 en Lucid. Parece que virtualenv está omitiendo la creación del enlace simbólico para warnings.py.virtualenv no creará un enlace simbólico de warnings.py para python 2.7

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

El archivo warnings.py está en /usr/local/lib/python2.7/.

No hay problema para crear virtualenv con python2.6.

Respuesta

4

Así que he comprobado el código virtualenv.py y tiene una lista REQUIRED_MODULES, que parece tener nombres de módulos para adjuntar en/lib dir del nuevo entorno. Esta lista se extiende por el módulo 'advertencias' después de satisfacer una condición:

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

versión de Python se indentified correctamente, así que no había ningún problema con virtualenv.py. Para especificar que estaba usando virtualenv instalado, no file virtualenv.py.

Después de eliminar el archivo virtualenv.pyc de python dist-packages, el problema desapareció. Así que parece, como si algo estuviera mal con el archivo virtualenv compilado, parece un problema con la comprobación de versiones de pitones.

+6

Tuve el mismo problema. Tuve que resolverlo por 1) crear --no-site-packages virtualenv usando el pitón predeterminado (2.6) 2) easy_install virtualenv en este virtualenv 3) activar virtualenv 4) ahora usando el comando virtualenv desde --no-site-packages virtualenv (cabeza explota) –

+1

@MikkoOhtamaa mismo aquí, aunque cambié los pasos 2 y 3, activando primero y luego instalando. –

Cuestiones relacionadas