在Win7 64位上编译sqlalchemy C扩展需要什么编译器?
我刚刚更新了sqlalchemy,看到以下信息:
building 'sqlalchemy.cprocessors' extension
***************************************************************************
Unable to find vcvarsall.bat
WARNING: The C extension could not be compiled, speedups are not enabled.
Failure information, if any, is above.
Retrying the build without the C extension now.
***************************************************************************
我在Windows 7 64位上运行Python 3.3 64位(使用WinPython发行版)。
我想编译C扩展,但对于64位的Python,有哪些编译器可供选择呢?比如MinGW、Visual C++ 2010等等?
特别是,能不能用微软的Express版本编译器来代替专业版?
最后,如果可以的话,能不能也解释一下使用特定编译器的优缺点是什么?
谢谢!
更新 1:
我安装了Microsoft Windows SDK for Windows 7.1,这个过程挺麻烦的,因为如果发现了更新版本的可再分发组件,它就不安装。
我按照cgohlke的说明操作,成功了,但出现了以下警告。这些警告正常吗?
building 'sqlalchemy.cprocessors' extension
processors.c
processors.obj : warning LNK4197: export 'PyInit_cprocessors' specified multiple times; using first specification
building 'sqlalchemy.cresultproxy' extension
resultproxy.c
resultproxy.obj : warning LNK4197: export 'PyInit_cresultproxy' specified multiple times; using first specification
building 'sqlalchemy.cutils' extension
utils.c
utils.obj : warning LNK4197: export 'PyInit_cutils' specified multiple times; using first specification
谢谢!
1 个回答
2
首先,下载免费的 Microsoft Windows SDK for Windows 7 和 .NET Framework 4。这个工具包里包含了和官方的 CPython 3.3 版本一样的编译器。安装之前,请先运行以下命令:
setlocal EnableDelayedExpansion
call "%ProgramFiles%\Microsoft SDKs\Windows\v7.1\Bin\SetEnv.Cmd" /Release /x64 /vista
set DISTUTILS_USE_SDK=1
另外,你也可以使用这个链接里的二进制文件:http://www.lfd.uci.edu/~gohlke/pythonlibs/#sqlalchemy