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

前端 未结 5 1435
予麋鹿
予麋鹿 2020-11-29 04:19

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 i

5条回答
  •  醉酒成梦
    2020-11-29 04:25

    I encountered this problem while trying to install pandas in 'develop' mode. I'm up & running now. My environment:

    • Windows XP Pro x64 SP2
    • WinPython 64bit 2.7.5.3 (Python 2.7.5.amd64) <-- "registered" as system's python distro using WinPython Control Panel application

    Problems encountered when running python setup.py develop:

    • Unable to find vcvarsall.bat
    • fatal error C1083: Cannot open include file: 'basetsd.h': No such file or directory ... exit code 2

    Solution:

    1. Download and install Microsoft Visual C++ 2008 Express.
    2. Download and install Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1. You will need only:
      • Developer Tools > Windows Headers and Libraries <-- this gives you basetsd.h
      • Developer Tools > Visual C++ Compilers <-- this gives you the 64-bit compilers
    3. Copy C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\vcvars64.bat to C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64\vcvarsamd64.bat. Observe the change in file name.
    4. Add C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin to PATH. This may not be required (I did so before re-installing the SDK w/ Headers & Libs; therefore, the necessity is unknown).

    At this point, running python setup.py develop completed successfully and python -c "import pandas; print pandas.__version__" resulted in the git tag I expected.

    [EDIT] Further reading:

    • error: Unable to find vcvarsall.bat
      • answer if you just want binaries to install
      • answer if you want to compile on x64 machine
      • answer about the file location/name change
    • distutils issue 7511

提交回复
热议问题