4

I try installing python modules (this time flask-bcrypt or py-bcrypt) and I can't get it to work because compilation failed.

I learned that I needed Visual Studio 2008 (I do own 2010 Professional, but it seems thats not enough). So I downloaded the Express Edition and ran again. This time it failed with some ValueError on path which turned out to be an issue with Python being x64 but Visual Studio being 32 bit.

I then made a search and did not find a single opportunity to configure my Express Edition for x64. All tutorials assumed the Professional version.

It can't seriously be correct that I need to buy the Professional version to be able to compile this plugins without some hacking in the code, can it?

Is there any easy way to get this stuff up and running. I would be glad to see someone provide a generic solution like

  • Install python
  • Install xyz
  • Do this and that

So that I can finally just run the usual Unix commands like pip install abc to install a module. I got this up and running with virtualenv finally, but as soon as I need to compile I get stuck again.

4

2 に答える 2

11

The command line VS 2008 compilers are included with "Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 Service Pack 1". During on the download and installation, make sure you select the x64 compiler.

Once you have the SDK installed, Python can build extensions without a copy of Visual Studio (Express or Professional) installed. It just takes a few commands to properly configure the environment.

I've extracted the following from my notes:

rem Configure the environment for 64-bit builds.
rem Use "vcvars32.bat" for a 32-bit build.
"C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat"

rem Convince setup.py to use the SDK tools.
set MSSdk=1
set DISTUTILS_USE_SDK=1

python setup.py install should now work. I don't know if anything special needs to be done to support pip.

于 2012-06-17T16:27:13.503 に答える
0

For Python 2.7 you can use the Microsoft Visual C++ Compiler for Python 2.7, which is able to build 64-bit binaries and is a lot smaller than the SDK: only 84 MB.

于 2016-01-26T16:07:31.240 に答える