나는 win7에서 cygwin에서 virtualenv 1.9.1을 사용하고 있습니다. 각 virtualenv는 옵션없이 생성됩니다 (분명히 디렉토리 이름 제외). 멋진 사용자 정의가 없습니다.virtualenv가 PYTHONPATH를 만들지 않습니다/pip 설치된 패키지가 작동하지 않습니다
모든 가상 서버는 래퍼 스크립트를 만들지 않았고 virtualenv 스크립트를 편집하지 않은 점에서 신선합니다. 필자는 다중 virtualenvs에 PYTHONPATH가 존재하지 않게하는 특수한 작업 (즉, 가상 작업을 오용하는 것보다는 오히려 오히려 오작동을 제외하고)을 수행하지 않을 것이라고 확신합니다.
각각의 새 virtualenv에 대한 virtualenv 활성화 스크립트는 PYTHONPATH를 만들지 않습니다. pip는 $VIRTUAL_ENV/lib/python2.7/site-packages/<packagedir>
아래에 패키지를 설치합니다 (예 : lib/python2.7/site-packages/html5lib
).
pip의 행동이 바람직합니다. 그러나 python을 실행하면 (virtualenv를 활성화 한 후) pip 설치 패키지를로드 할 수 없게됩니다 (즉, "no module named ...").
업데이트 : activate
에 PYTHONPATH를 추가하면 실제로 문제가 "해결"됩니다. 분명히, 나는 이것을 수동으로 유지하고 싶지 않고, activate_this.py
을 업데이트 할 필요가 없다. 나는 아직도 virtualenv가 지금 상자에서 곧바로 작동하지 않는 이유를 알고 싶다.
해결책은 무엇입니까? virtualenv는 이것을 사용하지 않았습니다. 지금 뭐가 잘못 됐어?
업데이트 2 :
$ virtualenv -vv newvirtualenv
Creating newvirtualenv/lib/python2.7
Symlinking Python bootstrap modules
Symlinking newvirtualenv/lib/python2.7/config
Symlinking newvirtualenv/lib/python2.7/lib-dynload
Symlinking newvirtualenv/lib/python2.7/os.py
Ignoring built-in bootstrap module: posix
Symlinking newvirtualenv/lib/python2.7/posixpath.py
Cannot import bootstrap module: nt
Symlinking newvirtualenv/lib/python2.7/ntpath.py
Symlinking newvirtualenv/lib/python2.7/genericpath.py
Symlinking newvirtualenv/lib/python2.7/fnmatch.py
Symlinking newvirtualenv/lib/python2.7/locale.py
Symlinking newvirtualenv/lib/python2.7/encodings
Symlinking newvirtualenv/lib/python2.7/codecs.py
Symlinking newvirtualenv/lib/python2.7/stat.py
Symlinking newvirtualenv/lib/python2.7/UserDict.py
File newvirtualenv/lib/python2.7/lib-dynload/readline.dll already exists
Symlinking newvirtualenv/lib/python2.7/copy_reg.py
Symlinking newvirtualenv/lib/python2.7/types.py
Symlinking newvirtualenv/lib/python2.7/re.py
Symlinking newvirtualenv/lib/python2.7/sre.py
Symlinking newvirtualenv/lib/python2.7/sre_parse.py
Symlinking newvirtualenv/lib/python2.7/sre_constants.py
Symlinking newvirtualenv/lib/python2.7/sre_compile.py
File newvirtualenv/lib/python2.7/lib-dynload/zlib.dll already exists
Symlinking newvirtualenv/lib/python2.7/warnings.py
Symlinking newvirtualenv/lib/python2.7/linecache.py
Symlinking newvirtualenv/lib/python2.7/_abcoll.py
Symlinking newvirtualenv/lib/python2.7/abc.py
Symlinking newvirtualenv/lib/python2.7/_weakrefset.py
Creating newvirtualenv/lib/python2.7/site-packages
Writing newvirtualenv/lib/python2.7/site.py
Writing newvirtualenv/lib/python2.7/orig-prefix.txt
Writing newvirtualenv/lib/python2.7/no-global-site-packages.txt
Creating parent directories for newvirtualenv/include
Symlinking newvirtualenv/include/python2.7
Creating newvirtualenv/bin
New python executable in newvirtualenv/bin/python2.7
Changed mode of newvirtualenv/bin/python2.7 to 0755
Also creating executable in newvirtualenv/bin/python
Changed mode of newvirtualenv/bin/python to 0755
Testing executable with newvirtualenv/bin/python2.7 -c "import sys;out=sys.stdout;getattr(out, "buffer", out).write(sys.prefix.encode("utf-8"))"
Got sys.prefix result: u'/cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv'
Creating newvirtualenv/lib/python2.7/distutils
Writing newvirtualenv/lib/python2.7/distutils/__init__.py
Writing newvirtualenv/lib/python2.7/distutils/distutils.cfg
Using existing setuptools egg: /usr/lib/python2.7/site-packages/virtualenv_support/setuptools-0.6c11-py2.7.egg
Installing setuptools...
Running command /cygdrive/c/Users/ma...ualenv/bin/python2.7 -c "#!python
\"\"\"Bootstra...sys.argv[1:])
" -v /usr/lib/python2.7/s...ols-0.6c11-py2.7.egg
Processing setuptools-0.6c11-py2.7.egg
Copying setuptools-0.6c11-py2.7.egg to /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/lib/python2.7/site-packages
Adding setuptools 0.6c11 to easy-install.pth file
Saving /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/lib/python2.7/site-packages/easy-install.pth
Installing easy_install script to /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/bin
changing mode of /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/bin/easy_install to 755
Installing easy_install-2.7 script to /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/bin
changing mode of /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/bin/easy_install-2.7 to 755
Installed /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/lib/python2.7/site-packages/setuptools-0.6c11-py2.7.egg
Processing dependencies for setuptools==0.6c11
Finished processing dependencies for setuptools==0.6c11
...Installing setuptools...done.
Installing existing pip-1.3.1.tar.gz distribution: /usr/lib/python2.7/site-packages/virtualenv_support/pip-1.3.1.tar.gz
Installing pip...
Running command /cygdrive/c/Users/ma...ualenv/bin/python2.7 -x /cygdrive/c/Users/ma...env/bin/easy_install /usr/lib/python2.7/s...ort/pip-1.3.1.tar.gz
Processing pip-1.3.1.tar.gz
Running pip-1.3.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-ZP_VIv/pip-1.3.1/egg-dist-tmp-H3XBh_
warning: no files found matching '*.html' under directory 'docs'
warning: no previously-included files matching '*.txt' found under directory 'docs/_build'
no previously-included directories found matching 'docs/_build/_sources'
Adding pip 1.3.1 to easy-install.pth file
Installing pip script to /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/bin
Installing pip-2.7 script to /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/bin
Installed /cygdrive/c/Users/marcin/Documents/codeprojects/newvirtualenv/lib/python2.7/site-packages/pip-1.3.1-py2.7.egg
Processing dependencies for pip==1.3.1
Finished processing dependencies for pip==1.3.1
...Installing pip...done.
Writing newvirtualenv/bin/activate
Writing newvirtualenv/bin/activate.fish
Writing newvirtualenv/bin/activate_this.py
Writing newvirtualenv/bin/activate.csh
추악한 해결책 : 아마'activate' 스크립트를 해킹하고 거기에 수동으로 경로를 추가 하시겠습니까? –
@ JakubM. 그게 나에게 일어 났지만, 이것은 분명히 뭔가 다른 일을하지 않거나 현재 버전의 virtualenv에서 버그가있는 것처럼 보입니다. – Marcin
'PYTHONPATH'는 빨간 청어입니다. ** activate **에 의해 ** 설정되지 않습니다 **. 결코 그렇지 않습니다. 'bin/python.exe'에있는 python 실행 파일은 대신'PYTHONHOME' (내부적으로) 설정을 담당합니다. 'virtualenv -vv' (두 개의'-v' 옵션)을 실행하고 문제를 디버그하는 데 도움이되도록이 디버그 결과를 보여줄 수 있습니까? –