bash:/ usr / local / bin / fab:/usr/local/opt/python/bin/python2.7:bad interpreter:没有这样的文件或目录

时间:2016-11-04 03:49:55

标签: python

面料不适合我。运行fabric时出现以下错误。

fab realm:prod role:tools,1 build
bash: /usr/local/bin/fab: /usr/local/opt/python/bin/python2.7: bad interpreter: No such file or directory
以前曾经工作过。但我不确定究竟发生了什么变化。 我运行了以下命令

brew doctor 
brew install git

我不知道那些brew命令如何搞乱我的python版本

$ which python
/usr/local/bin/python
$ ls -l /usr/local/bin/python
lrwxr-xr-x  1 vaibhav.chidrewar  admin  68 Nov  8  2014 /usr/local/bin/python -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python
$ which pip
/usr/local/bin/pip
$ which fab
/usr/local/bin/fab
$ head -n1 /usr/local/bin/pip
#!/usr/bin/python

$echo $PATH
/usr/local/lib/cw:/usr/local/bin:/Users/vaibhav.chidrewar/bin:/usr/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin

我尝试卸载并重新安装pip和fabric。但即使在那之后,我也得到同样的错误。

$ sudo easy_install pip
Searching for pip
Best match: pip 1.5.6
Processing pip-1.5.6-py2.7.egg
pip 1.5.6 is already the active version in easy-install.pth
Installing pip script to /usr/local/bin
Installing pip2.7 script to /usr/local/bin
Installing pip2 script to /usr/local/bin

Using /Users/vaibhav.chidrewar/Library/Python/2.7/site-packages/pip-1.5.6-py2.7.egg
Processing dependencies for pip
Finished processing dependencies for pip


$ sudo pip install fabric
Downloading/unpacking fabric
  Downloading Fabric-1.12.0-py2-none-any.whl (92kB): 92kB downloaded
Requirement already satisfied (use --upgrade to upgrade): paramiko>=1.10,<2.0 in ./Library/Python/2.7/lib/python/site-packages (from fabric)
Installing collected packages: fabric
Successfully installed fabric
Cleaning up...

之后我尝试安装Flask并且工作正常。 所以不确定Fabric有什么问题。

1 个答案:

答案 0 :(得分:0)

我发现我的.bash_profile没有获得来源。 因此失踪了。

export PATH="/Library/Frameworks/Python.framework/Versions/2.7/bin:${PATH}"

现在我将.bash_profile的内容复制到.bashrc并且事情再次正常工作