我試圖設置virtualenv指向Maya 2013的可執行文件,所以我可以在shell中運行它的單元測試。 Maya使用位於/usr/autodesk/maya/bin/mayapy
的自定義python 2.6可執行文件。我得到這些錯誤:virtualenv和Maya
$ virtualenv -p /usr/autodesk/maya/bin/mayapy mayapy
Running virtualenv with interpreter /usr/autodesk/maya/bin/mayapy
PYTHONHOME is set. You *must* activate the virtualenv before using it
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 2577, in <module>
main()
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 979, in main
no_pip=options.no_pip)
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1081, in create_environment
site_packages=site_packages, clear=clear))
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1289, in install_python
writefile(site_filename_dst, SITE_PY)
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 445, in writefile
f = open(dest, 'wb')
IOError: [Errno 2] No such file or directory: 'mayapy/lib/python26.zip/site.py'
我讀過virtualenv's page的virtualenv -h
輸出,一些基本的virtualenv writeups像this one,並搜查谷歌和SO兩者的virtualenv和Maya +的virtualenv配對,都無濟於事。
下面是詳細的輸出:
$ virtualenv -vv -p /usr/autodesk/maya/bin/mayapy mayapy
Running virtualenv with interpreter /usr/autodesk/maya/bin/mayapy
PYTHONHOME is set. You *must* activate the virtualenv before using it
Directory mayapy/lib/python2.6 already exists
Symlinking Python bootstrap modules
Cannot import bootstrap module: os
Ignoring built-in bootstrap module: posix
Cannot import bootstrap module: posixpath
Cannot import bootstrap module: nt
Cannot import bootstrap module: ntpath
Cannot import bootstrap module: genericpath
Cannot import bootstrap module: fnmatch
Cannot import bootstrap module: locale
Cannot import bootstrap module: encodings
Cannot import bootstrap module: codecs
Cannot import bootstrap module: stat
Cannot import bootstrap module: UserDict
File mayapy/lib/python2.6/lib-dynload/readline.so already exists
Cannot import bootstrap module: copy_reg
Cannot import bootstrap module: types
Cannot import bootstrap module: re
Cannot import bootstrap module: sre
Cannot import bootstrap module: sre_parse
Cannot import bootstrap module: sre_constants
Cannot import bootstrap module: sre_compile
File mayapy/lib/python2.6/lib-dynload/zlib.so already exists
Cannot import bootstrap module: warnings
Cannot import bootstrap module: linecache
Cannot import bootstrap module: _abcoll
Cannot import bootstrap module: abc
Directory mayapy/lib/python2.6/site-packages already exists
Writing mayapy/lib/python26.zip/site.py
Traceback (most recent call last):
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 2577, in <module>
main()
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 979, in main
no_pip=options.no_pip)
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1081, in create_environment
site_packages=site_packages, clear=clear))
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 1289, in install_python
writefile(site_filename_dst, SITE_PY)
File "/usr/local/lib/python2.6/dist-packages/virtualenv.py", line 445, in writefile
f = open(dest, 'wb')
IOError: [Errno 2] No such file or directory: 'mayapy/lib/python26.zip/site.py'
我不知道答案,但看到評論一直很薄...我使用python創建virtualenvs我想虛擬化而不是使用-p選項:'/ usr/autodesk/maya/bin/mayapy virtualenv mayapy' – tdelaney
我開始看到,雖然它花了一段時間才發現。這是否意味着我需要將virtualenv本身安裝到Maya的python中? –
嘗試在'PYTHONPATH'環境變量中添加'/ usr/local/lib/python2.6/dist-packages'或'/ usr/autodesk/maya/bin/python26.zip'? –