Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
866 views
in Technique[技术] by (71.8m points)

python - Running Cython in Windows x64 - fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory

I have been trying to install Cython for Python 2.7 on my Window 7 system. In particular, I prefer everything in 64 bits. (In case you wonder, I need Cython because Cython is one of the components I need for another package for some specialized numerical analysis. And x64 is potentially an advantage for storage of large data sets.)

So I downloaded the x64 Python 2.7 from the official website. Got Cython from Christoph Gohlke. The amd64 version for Python 2.7 of course. Before I installed, I added Python 2.7 into the registry with the .reg file found in Joe DF's answer here. Afterwards, I installed the Visual C++ compiler from here (I don't think it works) and here (but this one should). At this point, I have in my C:Program Files (x86)Microsoft Visual Studio 9.0VCin directory all of vcvars32.bat, vcvars64.bat, vcvars86_amd64.bat, vcvarsx86_ia64.bat. I ran vcvars64.bat and there was no error message.

Subsequently, I followed this page to create a "hello world" test file.

Then, I got this error.

...Tests>python setup.py build_ext --inplace
running build_ext
building 'hello' extension
error: Unable to find vcvarsall.bat

So I thought to myself: Well, Cython can't find that file because it does not exist. (I searched my whole harddrive for it.) So I copied vcvars64.bat from ...VCin to VC and changed the name to vcvarsall.bat. Now vcvarsall error is gone. And ... naturally, a new error emerges.

...Tests>python setup.py build_ext --inplace
running build_ext
building 'hello' extension
C:Program Files (x86)Microsoft Visual Studio 9.0VCBINamd64cl.exe /c /nolog
o /Ox /MD /W3 /GS- /DNDEBUG -IC:Python27include -IC:Python27PC /Tchello.c /F
obuildemp.win-amd64-2.7Releasehello.obj
hello.c
C:Python27includepyconfig.h(227) : fatal error C1083: Cannot open include fil
e: 'basetsd.h': No such file or directory
error: command '"C:Program Files (x86)Microsoft Visual Studio 9.0VCBINamd64
cl.exe"' failed with exit status 2

Now I have no idea how to proceed. What should I do? Your help is much appreciated.

(For clarity, I did try setting the compiler to Mingw32. But there are other errors. I am focusing on getting VC to work for now.)


EDIT: I tried using the SDK build environment CMD following the instructions on this page. I received the same error.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

In case anyone is currently (2017) facing same error with visual C++ 2015 tools, launch setup again and also select windows 8.1 / 10 SDK depending upon your OS. This will fix basestd.h error.

If it is still not working, try launching build tools from: C:Program Files (x86)Microsoft Visual C++ Build Tools.

Another alternative would be, just install anaconda 2 or 3 (64 bit if also you don't want memory errors). It contains all the important packages prebuilt: sklearn, matplotlib, scipy, numpy, pandas and even web development frameworks such as flask.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...