我在Windows中的虚拟机中构建Cython存在很多问题,我在OSX中没有遇到任何问题,而且它真的让我感到沮丧......
长话短说明我正在尝试构建/安装以下库: - Cython-0.19.2 - cython-hidapi - pycrypto-2.6.1
让我们从Cython开始...
>>setup.py clean install
running clean
running install
running build
running build_py
running build_ext
building 'Cython.Compiler.Code' extension
error: Unable to find vcvarsall.bat`
这可以通过以下方式纠正:SET VS90COMNTOOLS=%VS120COMNTOOLS%
但不是永久性的,我该如何永久保留?
然后再次运行>>setup.py clean install
:
running clean
running install
running build
running build_py
running build_ext
building 'Cython.Compiler.Code' extension
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
creating build\temp.win-amd64-2.7\Release\Cython
creating build\temp.win-amd64-2.7\Release\Cython\Compiler
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /TcCython\Compiler\Code.c /Fobuild\temp.win-amd64-2.7\Release\Cython\Compiler\Code.obj
Code.c
c:\python27\include\pymath.h(22) : warning C4273: 'round' : inconsistent dll linkage
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(51
6) : see previous definition of 'round'
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\link.exe /DLL /nologo /INCREMENTAL:NO /LIBPATH:C:\Python27\libs /LIBPATH:C:\Python27\PCbuild\amd64 /EXPORT:initCode build\temp.win-amd64-2.7\Release\Cython\Compiler\Code.obj /OUT:build\lib.win-amd64-2.7\Cython\Compiler\Code.pyd /IMPLIB:build\temp.win-amd64-2.7\Release\Cython\Compiler\Code.lib /MANIFESTFILE:build\temp.win-amd64-2.7\Release\Cython\Compiler\Code.pyd.manifest
Code.obj : warning LNK4197: export 'initCode' specified multiple times; using first specification
Creating library build\temp.win-amd64-2.7\Release\Cython\Compiler\Code.lib an
d object build\temp.win-amd64-2.7\Release\Cython\Compiler\Code.exp
C:\Program Files (x86)\Windows Kits\8.1\bin\x64\mt.exe -nologo -manifest build\temp.win-amd64-2.7\Release\Cython\Compiler\Code.pyd.manifest -outputresource:build\lib.win-amd64-2.7\Cython\Compiler\Code.pyd;2
build\temp.win-amd64-2.7\Release\Cython\Compiler\Code.pyd.manifest : general error c1010070: Failed to load and parse the manifest. The system cannot find the file specified.
error: command 'mt.exe' failed with exit status 31
我没做什么似乎纠正了第二个问题,我安装了VS2013。我确定这一切都可以修复我的环境变量%PATH%...但我不确定它们有什么问题:
c:\ altera \ 12.1sp1 \ modelsim_ase \ win32aloem; C:\ Python27; C:\ WINNT \ system32; C:\ WINNT; C:\ WINNT \ System32 \ Wbem; C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ bin; SET VS90COMNTOOLS =%VS120COMNTOOLS%; C:\ Program Files(x86)\ Microsoft Visual Studio 12.0 \ VC \ include
修改
仍在寻找第一期的永久修复。
修复第二个问题: Microsoft Security Essentials正在锁定清单文件,将项目目录添加到其排除的目录中可以解决问题。
新问题: 构建Cython-HIDAPI时:
running clean
removing 'build\temp.win-amd64-2.7' (and everything under it)
removing 'build'
running install
running build
running build_ext
skipping 'hid.c' Cython extension (up-to-date)
building 'hid' extension
creating build
creating build\temp.win-amd64-2.7
creating build\temp.win-amd64-2.7\Release
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tchid.c /Fobuild\temp.win-amd64-2.7\Release\hid.obj
hid.c
c:\python27\include\pymath.h(22) : warning C4273: 'round' : inconsistent dll linkage
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE\math.h(516) : see previous definition of 'round'
hid.c(801) : warning C4267: '=' : conversion from 'size_t' to 'int', possible loss of dataC:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe /c /nologo /Ox /MD /W3 /GS- /DNDEBUG -IC:\Python27\include -IC:\Python27\PC /Tchid-libus
b.c /Fobuild\temp.win-amd64-2.7\Release\hid-libusb.obj
hid-libusb.c
hid-libusb.c(34) : fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory
error: command '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.exe"' failed with exit status 2
通过修改C文件来检查win vs linux header ...
#ifdef __linux__
/* Unix */
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/ioctl.h>
#include <sys/utsname.h>
#include <fcntl.h>
#include <pthread.h>
#endif
以这种方式解决的大多数剩余问题
会针对我遇到的最后一个问题发布一个新问题,因为这个问题变得混乱了,我会把这个问题留给其他可能在将来遇到此问题的人