Value error trying to install Python for Windows extensions

前端 未结 7 1030
清歌不尽
清歌不尽 2020-11-27 05:42

I have Microsoft Visual Studio 2008 installed already. I downloaded the zip file Python for Windows extensions and extracted the contents into my Python27 folder. There\'s n

相关标签:
7条回答
  • 2020-11-27 05:45

    As stated it's trying to use a 32-bit compiler for 64-bit python. I was able to build successfully by:

    1. Finding vcvarsx86_amd64.bat in C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin\x86_amd64 (depends on your setup)
    2. Open a cmd prompt
    3. Run SET VS90COMNTOOLS=%VS120COMNTOOLS% (depends on setup, see https://stackoverflow.com/a/10558328/2362877)
    4. Run vcvarsx86_amd64.bat
    5. Then pip install <package>
    0 讨论(0)
  • 2020-11-27 05:45

    Python for Windows extensions is only supported on

    32-bit MS Windows (95/98), 32-bit MS Windows (NT/2000/XP), All 32-bit MS Windows (95/98/NT/2000/XP), Win2K, WinXP, WinCE

    Taken from the sourceforge project page. Seems like you may be out of luck!

    EDIT: However... reading this seems to imply otherwise.

    0 讨论(0)
  • 2020-11-27 05:46

    If you have a 64 bit Python installation:

    Install "Microsoft Visual Studio 2008 Professional Edition" with the "X64 Compiler and Tools" option enabled.

    Alternatively, download pywin32-214.win-amd64-py2.7.exe from http://sourceforge.net/projects/pywin32/files/pywin32/Build%20214/

    0 讨论(0)
  • 2020-11-27 05:47

    I tried all the other answers and a lot more. Ended up installing python 32-bit, which fixed the issue right away.

    If this is an option, it's most likely the easiest fix.

    0 讨论(0)
  • 2020-11-27 05:51

    Another possible reason for this problem to appear is that you have just installed Visual Studio and the command prompt you're using had been hanging around from the time before the installation.

    This is because MSVC installer sets few environment variables and one of these variables ( VS90COMNTOOLS )has to be set for vcvarsall.bat to execute correctly. But each running program in Windows holds its own local copy of environment variables that gets inherited (copied) from parent process upon child start-up. Thus, after child has started, it does not receive alterations performed on the system-level envvars. And the only way of getting updated environment variables is trough spawning a new instance of a child process with parent that has updated version of envvars.

    0 讨论(0)
  • 2020-11-27 06:02

    None of these answers worked for me but I found the solution on the issue tracker:

    1. Open cmd.
    2. cd "C:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin"
    3. Type vcvars32.bat or vcvars64.bat
    4. In the same prompt and -without closing: cd back to the Python module you're trying to install.
    5. The code should now install.

    Source: http://bugs.python.org/issue7511

    0 讨论(0)
提交回复
热议问题