3

我似乎无法让 Fabric 正确运行。我发现这篇文章并没有解决我的问题让 Fabric Python 库正常工作

我使用 Homebrew 安装了 Python brew install python(这也安装了 PIP):

运行which python我得到:

/usr/local/Cellar/python/2.7.3/bin/python

然后我安装了织物pip install fabric

Requirement already satisfied (use --upgrade to upgrade): fabric in /usr/local/lib/python2.7/site-packages
Requirement already satisfied (use --upgrade to upgrade): ssh>=1.7.14 in /usr/local/lib/python2.7/site-packages (from fabric)
Requirement already satisfied (use --upgrade to upgrade): pycrypto>=2.1,!=2.4 in /usr/local/lib/python2.7/site-packages (from ssh>=1.7.14->fabric)

另一篇文章建议织物将位于/usr/local/Cellar/python/2.7.1/bin/fab

在上面做一个ls(但在我的例子中是 2.7.3)得到以下(没有织物)。

lrwxr-xr-x   1 darron  staff   80 Oct 26 17:37 2to3 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/2to3
lrwxr-xr-x   1 darron  staff   82 Oct 26 17:37 2to3-2 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/2to3-2
lrwxr-xr-x   1 darron  staff   84 Oct 26 17:37 2to3-2.7 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/2to3-2.7
-r-xr-xr-x   1 darron  staff  422 Oct 26 17:37 easy_install
-r-xr-xr-x   1 darron  staff  430 Oct 26 17:37 easy_install-2.7
lrwxr-xr-x   1 darron  staff   80 Oct 26 17:37 idle -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/idle
lrwxr-xr-x   1 darron  staff   81 Oct 26 17:37 idle2 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/idle2
lrwxr-xr-x   1 darron  staff   83 Oct 26 17:37 idle2.7 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/idle2.7
-r-xr-xr-x   1 darron  staff  380 Oct 26 17:37 pip
-r-xr-xr-x   1 darron  staff  388 Oct 26 17:37 pip-2.7
lrwxr-xr-x   1 darron  staff   81 Oct 26 17:37 pydoc -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/pydoc
lrwxr-xr-x   1 darron  staff   82 Oct 26 17:37 pydoc2 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/pydoc2
lrwxr-xr-x   1 darron  staff   84 Oct 26 17:37 pydoc2.7 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/pydoc2.7
lrwxr-xr-x   1 darron  staff   82 Oct 26 17:37 python -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/python
lrwxr-xr-x   1 darron  staff   89 Oct 26 17:37 python-config -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/python-config
lrwxr-xr-x   1 darron  staff   83 Oct 26 17:37 python2 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/python2
lrwxr-xr-x   1 darron  staff   90 Oct 26 17:37 python2-config -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/python2-config
lrwxr-xr-x   1 darron  staff   85 Oct 26 17:37 python2.7 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/python2.7
lrwxr-xr-x   1 darron  staff   92 Oct 26 17:37 python2.7-config -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/python2.7-config
lrwxr-xr-x   1 darron  staff   83 Oct 26 17:37 pythonw -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/pythonw
lrwxr-xr-x   1 darron  staff   84 Oct 26 17:37 pythonw2 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/pythonw2
lrwxr-xr-x   1 darron  staff   86 Oct 26 17:37 pythonw2.7 -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/pythonw2.7
lrwxr-xr-x   1 darron  staff   84 Oct 26 17:37 smtpd.py -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/smtpd.py
lrwxr-xr-x   1 darron  staff   87 Oct 26 17:37 smtpd2.7.py -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/smtpd2.7.py
lrwxr-xr-x   1 darron  staff   85 Oct 26 17:37 smtpd2.py -> /usr/local/Cellar/python/2.7.3/Frameworks/Python.framework/Versions/2.7/bin/smtpd2.py

我已将实际安装定位在/usr/local/lib/python2.7/site-packages

drwxr-xr-x  14 darron  staff   476 Oct 26 17:41 Crypto
drwxr-xr-x   9 darron  staff   306 Oct 26 17:41 Fabric-1.4.3-py2.7.egg-info
drwxr-xr-x  10 darron  staff   340 Oct 26 17:37 distribute-0.6.28-py2.7.egg
-rw-r--r--   1 darron  staff   237 Oct 26 17:37 easy-install.pth
drwxr-xr-x  10 darron  staff   340 Oct 26 17:41 fabfile
drwxr-xr-x  41 darron  staff  1394 Oct 26 17:41 fabric
drwxr-xr-x   7 darron  staff   238 Oct 22 08:13 git_remote_helpers
lrwxr-xr-x   1 darron  staff    93 Oct 22 08:13 git_remote_helpers-0.1.0-py2.7.egg-info -> ../../../Cellar/git/1.8.0/lib/python2.7/site-packages/git_remote_helpers-0.1.0-py2.7.egg-info
drwxr-xr-x   4 darron  staff   136 Oct 26 17:37 pip-1.2.1-py2.7.egg
drwxr-xr-x   7 darron  staff   238 Oct 26 17:41 pycrypto-2.6-py2.7.egg-info
-rw-r--r--   1 darron  staff   144 Oct 26 17:37 setuptools-0.6c11-py2.7.egg-info
-rw-r--r--   1 darron  staff    34 Oct 26 17:37 setuptools.pth
-rw-r--r--   1 darron  staff  1224 Oct 26 17:37 sitecustomize.py
-rw-r--r--   1 darron  staff   600 Oct 26 17:37 sitecustomize.pyc
drwxr-xr-x  72 darron  staff  2448 Oct 26 17:41 ssh
drwxr-xr-x   8 darron  staff   272 Oct 26 17:41 ssh-1.7.14-py2.7.egg-info

我的问题是如何让它工作?fab在提示下运行让我:

-bash: fab: command not found

注意 - 我的路径设置/etc/paths如下:

/usr/local/bin
/usr/local/sbin
/usr/bin
/bin
/usr/sbin
/sbin
4

1 回答 1

7

您发布的链接已过时。fab应该位于/usr/local/share/python目录中——Homebrew 的 Python 将已安装模块中的脚本放在该目录中。添加/usr/local/share/python到您的PATH.

于 2012-10-30T15:10:26.117 回答