计算机修复后,我的 python 项目目录(Windows)发生了变化(比如从 d: 到 f:)。
现在我所有的 virtualenv 都坏了。激活 env 后,virtualenv 中的项目无法找到依赖项,并且自定义脚本(来自 env\scripts 文件夹)将无法工作
尝试运行:
virtualenv --relocateble ENV_NAME (with the env name ..)
就像这样堆栈溢出问题 https://stackoverflow.com/questions/7153113/virtualenv-relocatable-does-it-really-work它输出了很多行,例如:
Script agent\Scripts\deactivate.bat cannot be made relative
我的 virtualenv 仍然损坏。
当我手动更改activate.bat时set VIRTUAL_ENV
到新的道路。一些脚本再次工作。但重定位脚本仍然无法运行,并且大多数脚本仍然损坏
即使运行 python 解释器也会失败:
Traceback (most recent call last):
File "F:\Python27\learn\agent\agent\lib\site.py", line 677, in <module>
main()
File "F:\Python27\learn\agent\agent\lib\site.py", line 666, in main
aliasmbcs()
File "F:\Python27\learn\agent\agent\lib\site.py", line 506, in aliasmbcs
import locale, codecs
File "F:\Python27\learn\agent\agent\lib\locale.py", line 19, in <module>
import functools
ImportError: No module named functools
有没有什么办法解决这一问题?帮助
Update:我还手动更改了 ENV\Scripts 中所有脚本中的 shebang python 解释器行。现在全部失败,并出现与上面相同的 python 失败
另一个更新:到@udi系统python路径是:
['', 'C:\\dev\\Python27\\lib\\site-packages\\distribute-0.6.37-py2.7.egg', 'C:\\
dev\\Python27\\lib\\site-packages\\pip-1.3.1-py2.7.egg', 'C:\\dev\\Python27\\lib
\\site-packages\\numpy-1.7.1-py2.7-win32.egg', 'C:\\dev\\Python27\\lib\\site-pac
kages\\pandas-0.11.0-py2.7-win32.egg', 'C:\\dev\\Python27\\lib\\site-packages\\p
ytz-2013b-py2.7.egg', 'C:\\dev\\Python27\\lib\\site-packages\\python_dateutil-2.
1-py2.7.egg', 'C:\\dev\\Python27\\lib\\site-packages\\six-1.3.0-py2.7.egg', 'C:\
\dev\\Python27\\lib\\site-packages\\tornado-3.0.1-py2.7.egg', 'C:\\dev\\Python27
\\lib\\site-packages\\pyzmq-13.1.0-py2.7-win32.egg', 'C:\\dev\\Python27\\lib\\si
te-packages\\pygments-1.6-py2.7.egg', 'C:\\Windows\\system32\\python27.zip', 'C:
\\dev\\Python27\\DLLs', 'C:\\dev\\Python27\\lib', 'C:\\dev\\Python27\\lib\\plat-
win', 'C:\\dev\\Python27\\lib\\lib-tk', 'C:\\dev\\Python27', 'C:\\dev\\Python27\
\lib\\site-packages', 'C:\\dev\\Python27\\lib\\site-packages\\setuptools-0.6c11-
py2.7.egg-info']
因为我无法从 virtualenv 运行 python,所以无法从那里打印 python 路径