【问题标题】:Installing Fabric On Windows (Error No Module Called Readline)在 Windows 上安装 Fabric(错误 No Module Named Readline)
【发布时间】:2009-12-16 19:50:04
【问题描述】:

我正在尝试在 Windows 上使用 Fabric 0.1.1 部署工具 (http://docs.fabfile.org/),但我们遇到了 readline 模块的问题。我经历了各种线程,但似乎无法解决问题。这很重要,因为我们无法从基于 Windows 的机器上部署应用程序。

C:\Documents and Settings\dev\Desktop\deploy>fab
Traceback (most recent call last):
  File "C:\python\Scripts\fab-script.py", line 8, in <module>
    load_entry_point('fabric==0.1.1', 'console_scripts', 'fab')()
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 277, in load_entry_point
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 2180, in load_entry_point
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\pkg_resources.py"
, line 1913, in load
  File "build\bdist.win32\egg\fabric.py", line 25, in <module>
**ImportError: No module named readline**

安装模块结果:

**easy_install readline**
Searching for readline
Reading http://pypi.python.org/simple/readline/
Reading http://www.python.org/
Best match: readline 2.6.4
Downloading http://pypi.python.org/packages/source/r/readline/readline-2.6.4.tar
.gz#md5=7568e8b78f383443ba57c9afec6f4285
Processing readline-2.6.4.tar.gz
Running readline-2.6.4\setup.py -q bdist_egg --dist-dir c:\docume~1\ji81b9~1.che
\locals~1\temp\easy_install-pzkz1a\readline-2.6.4\egg-dist-tmp-szs2ps
Traceback (most recent call last):
  File "C:\python\Scripts\easy_install-script.py", line 8, in <module>
    load_entry_point('setuptools==0.6c9', 'console_scripts', 'easy_install')()
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1671, in main
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1659, in with_ei_usage
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 1675, in <lambda>
  File "c:\python\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "c:\python\lib\distutils\dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "c:\python\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 211, in run
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 446, in easy_install
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 476, in install_item
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 655, in install_eggs
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 930, in build_and_install
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\comman
d\easy_install.py", line 919, in run_setup
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 27, in run_setup
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 63, in run
  File "c:\python\lib\site-packages\setuptools-0.6c9-py2.6.egg\setuptools\sandbo
x.py", line 29, in <lambda>
  File "setup.py", line 93, in <module>
AttributeError: 'module' object has no attribute 'symlink'

有人解决了这个问题吗?或者有人可以提出解决方法吗?

【问题讨论】:

  • 我在 Windows 中工作,但请使用 cygwin,包括 python、fabric 和 git 进行版本控制和部署。绝对没有麻烦,效果很好。您只需更改 fabric/base.py 并删除与 win32api 一致的值 'cygwin'。但是除了那个小错误之外,它运行得非常顺利

标签: python windows deployment fabric


【解决方案1】:

您尝试使用easy_install 安装的readline 模块适用于OS X,而不是Windows。那里有与 Windows 兼容的 readline 替代品,但也许您应该先尝试将 fabric 本身更新到更新的版本(0.9 现已推出)。

greping 0.9 版本的源码并没有发现对readline 的任何依赖。

【讨论】:

  • 这是我的第一个想法,但是关于如何通过 easy_install 安装的任何想法?我认为这可能是下载源代码并通过cygwin编译的情况......
  • 尝试easy_install -U fabric 获取最新版本。
  • 太棒了,谢谢。我从头开始使用 Fabric 0.9,并在此处写下了我在 Windows 上安装的步骤:blog.oogly.co.uk/builddeploy/…
【解决方案2】:

按照这些步骤对我完全有效:

1) 使用来自here 的 x86 的 MSI installer 安装。

2) 安装在默认的 C:\Python27 目录中。

3) 新建目录:C:\Python27\Scripts

4) 将 C:\Python27 和 C:\Python27\Scripts 添加到系统路径:

5) 将distribute_setup.pyhere 下载到C:\Python27\Scripts

6) 打开命令行,导航到 C:\Python27\Scripts,运行:'python Distribute_setup.py'

7) 现在运行“easy_install pip”

8) 现在运行“pip install fabric”

9) 你应该得到一个错误,说 PyCrypto 无法安装。您可以从here 下载预构建版Windows binary。运行这个来安装 PyCrypto。

10) 再次运行“pip install fabric”,它应该说一切都已安装。

11) 在不同的目录(比如 c:\dev\hello)创建一个 fabfile.py 并添加以下代码:

def hello(name="world"):
    print("Hello %s!" % name)

12) cd 到这个目录并运行'fab hello:working'。你应该看到输出说

Hello working!

Done.

【讨论】:

    【解决方案3】:

    试试这个readline。它是一个适用于 Windows 的模块,它允许 IPython 中的附加功能不是本机的,并且可能适用于您正在尝试做的事情。

    【讨论】:

    • 这适用于 readline 问题但是...我遇到了一个 win32 模块错误(我也通过安装 pywin32 修复了该错误)。但是,现在我遇到了 paramiko SSH 异常 - paramiko.SSHException: No suitable address family for x.x.x.x
    【解决方案4】:

    0.1.1 是旧版本,我相信。我在 Windows 上使用 ActivePython (w/ PyPM) 安装 Fabric 没有问题:

    C:\> pypm install fabric
    Ready to perform these actions:
    The following packages will be installed:
     fabric-0.9.0 pycrypto-2.0.1
    Get: [pypm.activestate.com] fabric 0.9.0-1
    Get: [pypm.activestate.com] pycrypto 2.0.1-1
    Installing fabric-0.9.0
    Fixing script C:\Users\sridharr\AppData\Roaming\Python\Scripts\fab-script.py
    Installing pycrypto-2.0.1
    

    【讨论】:

    • 如果这确实有效(我没有尝试过 - 我修复了基础 python 安装),你真的应该联系 Fabric 人员并确保他们在安装说明中添加注释 - 将有助于为人们节省大量时间。
    • 乔恩,我在他们的问题跟踪器中提出了一个请求:code.fabfile.org/issues/show/127
    • 太棒了,谢谢。我相信这会帮助很多处于同样情况的人......
    【解决方案5】:
    1. http://pypi.python.org/pypi/setuptools#downloads 下载并运行您的python 版本的easy_install 安装程序。即:setuptools-0.6c11.win32-py2.6.exe
    2. 在命令提示符下,启动 easy_install -U fabric 以安装最新的 fabric 版本。

    【讨论】:

      【解决方案6】:

      如果您想将整个堆栈朝那个方向移动,Cygwin 应该可以使用 Readline。

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 2016-03-27
        • 2012-11-22
        • 1970-01-01
        • 2015-10-20
        • 2018-03-08
        • 1970-01-01
        • 2014-10-11
        相关资源
        最近更新 更多