在 Python 中使用 Fabric
我已经使用 pip 在 Python2.6 上安装了 Fabric,它创建了两个目录:
/Library/Python/2.6/site-packages/fabfile
/Library/Python/2.6/site-packages/fabric
当我最初运行 $ fab 命令时,它说“命令未找到”。然后我确保我的系统路径包含这两个文件夹,但我仍然得到“命令未找到”。此外,我查看了每个文件夹,但找不到 fab 文件或目录。
注意:我可以从 Python 提示符执行此操作
>>> from fabric.api import ...
我需要做什么才能执行 $ fab
命令?谢谢。
I have installed Fabric on Python2.6 using pip, and it has created two directories:
/Library/Python/2.6/site-packages/fabfile
/Library/Python/2.6/site-packages/fabric
When I initially ran the $ fab command it said "command not found". Then I made sure my system path included both folders, and still I got "command not found". Furthermore, I looked in each folder and could not find the fab
file or directory.
Note: I can do this from the Python prompt
>>> from fabric.api import ...
What do I need to do to be able to execute the $ fab
command? Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我完全按照托森所说的去做,这对我很有用。
我在 Mac OS X 上的
/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/fab
中找到了fab
文件。I did exactly what Torsen saids and it works for me.
I found
fab
file at/opt/local/Library/Frameworks/Python.framework/Versions/2.6/bin/fab
on Mac OS X.像这样的执行程序通常不会复制到您的 python 库文件夹中(因此不在站点包中)。在 Ubuntu 中,例如将其复制到 PATH 中的
/usr/bin
中。我不知道它是否适合你的情况(因为它不会自动出现在你的路径中)。因此,您所能做的就是在文件系统中搜索fab
。附:
您可以在 python 解释器中导入 Fabric 是正确的,因为 python 库(在您的站点包中)位于您的 PATH 中,尽管如上所述,执行 fab 的文件位于其他位置。
Executives like this are usually not copied to your library folder of python (so not in site-packages). In Ubuntu this one is for example copied into
/usr/bin
which is in the PATH. I don't know though were it is in your case (since it is not automatically in your PATH). So all you can do is search forfab
in your file system.PS:
That you can import fabric in your python interpreter is correct, since the python library (in your site-packages) is in your PATH, though as said, the file to execute
fab
is somewhere else.