0

我使用 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 中的包。

4

1 回答 1

0

我通过在终端配置中设置默认 shell 解决了这个问题。我不知道这与使用 'chsh' 设置默认 shell 有什么不同,但它可以工作。感谢大家。

于 2013-10-30T11:05:20.750 回答