我使用 vim、mac os x、virtualenv 和 zsh 来开发 python。
但是我发现了一件很奇怪的事情,在我使用 virtualenv 创建环境并安装 python 包并在命令行中pip install fabric
执行之后。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 中的包。