2013-10-30 82 views
0

我使用vim,mac os x,virtualenv和zsh开发python。我不能在vim中执行命令,但它可以在shell中执行?

但是我发现一个很奇怪的事情,那就是在我使用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中的软件包。

+2

您是否在vim shell中再次输入bin/activate'? – moofins

+0

'echo $ PATH'和':!echo $ PATH'各自的结果是什么?这听起来像你已经回答了你自己的问题。路径问题 – aychedee

+0

@moofins看来它不需要在vim shell中再次获取源代码。 –

回答

0

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