在windows上面 安装virtualenv 和fabric

本文介绍在Windows环境下安装Python Fabric的方法,包括使用MinGW或MSVC编译器安装所需依赖,预编译的pyCrypto二进制文件安装方式,以及通过虚拟环境安装Fabric。另外还提供了一个使用Cygwin进行安装的方案。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

http://stackoverflow.com/questions/9000380/install-python-fabric-on-windows




fabric installs just fine on Windows, but you will need to either:


    have a compiler installed to build the pycrypto dependency during setup.If you don't have one already, install MinGW or you can use the free version of MSVC.
    install pre-built Windows binaries for pyCrypto here.


I install it in a virtualenv like so:


virtualenv fabenv
fabenv\Scripts\activate.bat
pip install fabric


Another Tip: When you have it up and running you can use pageant to load your ssh keys and avoiding using password-based authentication



Solution using Cygwin:


    Install Cygwin
    Select packages: Python, Gcc, Wget and Openssh
    In Cygwin run: python --version to verify your Python version
    From http://pypi.python.org/pypi/setuptools download the .egg version of setuptools (NOT the Windows .exe), for your version of Python.
    In Cygwin run: sh setuptools-*.egg to install the downloaded setuptools package
    In Cygwin run: easy_install pip (I just like Pip, I think you could the next step with easy_install as well)
    In Cygwin run: pip install fabric
    And now comes the crucial part: if the above step fails with some "could not remap xxx.dll" error, on the install of the Python ssh package then:
    Exit Cygwin
    Start a cmd.exe an in it run: c:\cygwin_path\bin\ash.exe
    In the ash shell run: /bin/rebaseall
    In Cygwin retry: pip install fabric, it should succeed now :)


Windows安装使用 `virtualenv` 非常简单。以下是安装步骤: 1. 首先,确保您已经安装了 Python。您可以从 Python 官方网站(https://www.python.org)下载并安装最新版本的 Python。 2. 打开命令提示符(CMD)或 PowerShell。您可以在 Windows 搜索栏中键入 "cmd" 或 "powershell" 并打开相应的应用程序。 3. 确保您的环境变量中已经添加了 Python 的安装路径。您可以在命令提示符或 PowerShell 中输入以下命令来验证 Python 是否正确安装: ``` python --version ``` 如果您能够看到 Python 的版本号,则说明 Python 安装成功。 4. 使用以下命令安装 `virtualenv`: ``` pip install virtualenv ``` 这将使用 pip 包管理器安装 `virtualenv`。 5. 创建一个新的虚拟环境。在命令提示符或 PowerShell 中,导航到您想要创建环境的目录,并运行以下命令: ``` virtualenv myenv ``` 这将创建一个名为 `myenv` 的新虚拟环境。 6. 激活虚拟环境。在命令提示符或 PowerShell 中,使用以下命令来激活虚拟环境: ``` myenv\Scripts\activate ``` 您将看到命令提示符或 PowerShell 的左侧显示 `(myenv)`,表示您已成功激活虚拟环境。 现在,您已经成功安装并激活了 `virtualenv`,可以在虚拟环境中安装所需的软件包并进行开发工作。当您完成工作后,可以使用以下命令来退出虚拟环境: ``` deactivate ``` 这些是在 Windows安装使用 `virtualenv` 的基本步骤。祝您使用愉快!
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值