Installing Fabric under Windows 7 64-bit, with virtualenv.
It's a bit of a pain to do, but I managed to get Fabric working on my Windows 7 64-bit machine. You'll need pip in advance, I shouldn't need to tell you how to get it.
I did this in Python 2.7, but these steps will probably work for others.
The basic steps are:
- Create a virtual environment
- Get/install Mingw
- Install PyCrypto
- Install pywin32
- Install fabric
Init a virtualenv
If you want to do this in a virtualenv, you'll need to do this in the normal way:
> virtualenv --no-site-packages .env > .env\Scripts\activate.bat
If you choose to use virtualenv, all hacking will take place in your .env\Lib folder unless otherwise specified. If not, you'll be looking in C:\Python27\Lib
Install MinGW
The mingw website has instructions on this matter.
Remember to add the \bin folder to your path. You'll need it.
Install PyCrypto
PyCrypto is a Fabric dependency, and it needs to be compiled via MinGW. To do this, you'll need to edit the file `Lib\distutils\distutils.cfg`. Add the following lines:
[build] compiler=mingw32
You'll also need to mess with your C:\Python27\distutils\cygwincompiler.py. This is in C:\Python27 even for you virtualenv types.
Remove all "-mno-cygwin" flags from lines 322-327 (or wherever the call to set_executables is), so that they look like this:
self.set_executables(compiler='gcc -O -Wall',
compiler_so='gcc -mdll -O -Wall',
compiler_cxx='g++ -O -Wall',
linker_exe='gcc',
linker_so='%s %s %s'
% (self.linker_dll, shared_option,
entry_point))Then, you should be able to install it using pip.
Install pywin32
The gotcha here is to NOT install the 64-bit version, or at least it was for me. Go to http://sourceforge.net/projects/pywin32/ and find the latest 32-bit file for your python from the latest build. My installer was called "pywin32-217.win32-py2.7.exe"
If you're using a virtualenv, you have two options:
- Run the installer as usual and copy the files from C:\Python27\Lib\site-packages
- Run the installer from an activated virtualenv using easy_install:
> easy_install C:\Path\To\installer.exe
Install Fabric
Finally, you can install fabric just how you expected to in the first place: "pip install fabric"
Now, on to actually try out this Fabric business.