我使用vim,mac os x,virtualenv和zsh来开发python。
但我发现一个非常奇怪的事情,在我使用virtualenv创建环境并安装带有pip install fabric
的python包并在命令行中执行fab
之后。效果很好。
然后我打开vim并用fab
执行:!fab
,它会给我以下错误:
Traceback (most recent call last): │ * Restarting with reloader
File "/usr/local/bin/fab", line 5, in <module> │ * Detected change in '/Users/ccheng/workspace/rms-rest/rms/account.py', reloading
from pkg_resources import load_entry_point │ * Restarting with reloader
File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 2793, in <module> │ * Detected change in '/Users/ccheng/workspace/rms-rest/rms/account.py', reloading
│ * Restarting with reloader
File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 673, in require │ * Detected change in '/Users/ccheng/workspace/rms-rest/rms/rms.py', reloading
def subscribe(self, callback): │ * Restarting with reloader
File "build/bdist.macosx-10.9-intel/egg/pkg_resources.py", line 576, in resolve │ * Detected change in '/Users/ccheng/workspace/rms-rest/rms/rms.py', reloading
plugin_env, full_env=None, installer=None, fallback=True │ * Restarting with reloader
pkg_resources.DistributionNotFound: Fabric==1.8.0 │ * Detected change in 'run.py', reloading
│ * Restarting with reloader
shell returned 1
我认为这是因为当我打开vim时,某些python path
变量已被重置,所以我找不到virtualenv中安装的软件包。
答案 0 :(得分:0)
我通过在终端配置中设置默认shell来解决问题。我不知道这与使用'chsh'设置默认shell有什么不同,但它有效。谢谢大家。