2

I have Python 2.6 and Visual Studio 2008 running on a Win7 x64 machine. When I try to build the basic python extension example in c "example_nt" as found in the python 2.6 sources distribution, it fails:

python setup.py build

And this results in:

running build
running build_ext
building 'aspell' extension
Traceback (most recent call last):
  File "setup.py", line 7, in <module>
    ext_modules = [module1])
  File "C:\Python26\lib\distutils\core.py", line 152, in setup
    dist.run_commands()
  File "C:\Python26\lib\distutils\dist.py", line 975, in run_commands
    self.run_command(cmd)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "C:\Python26\lib\distutils\command\build.py", line 134, in run
    self.run_command(cmd_name)
  File "C:\Python26\lib\distutils\cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "C:\Python26\lib\distutils\dist.py", line 995, in run_command
    cmd_obj.run()
  File "C:\Python26\lib\distutils\command\build_ext.py", line 343, in run
    self.build_extensions()
  File "C:\Python26\lib\distutils\command\build_ext.py", line 469, in build_extensions
self.build_extension(ext)
  File "C:\Python26\lib\distutils\command\build_ext.py", line 534, in build_extension
depends=ext.depends)
  File "C:\Python26\lib\distutils\msvc9compiler.py", line 448, in compile
self.initialize()
  File "C:\Python26\lib\distutils\msvc9compiler.py", line 358, in initialize
    vc_env = query_vcvarsall(VERSION, plat_spec)
  File "C:\Python26\lib\distutils\msvc9compiler.py", line 274, in query_vcvarsall
raise ValueError(str(list(result.keys())))
ValueError: [u'path']

What can I do to fix this? Any help will be appreciated

Alexandros
  • 4,425
  • 4
  • 23
  • 21
  • 1
    Make sure you are running from the "Visual Studio Command Prompt" that has the appropriate environmental variables set, and that the version of Python you are using matches the bit-ness (32/64) of the compiler. – Adam Vandenberg Jan 08 '11 at 19:47
  • This is a duplicate of http://stackoverflow.com/questions/4624507 – cgohlke Jan 09 '11 at 01:36

2 Answers2

3

For Win7 x64 machine Python 2.6 (x64) machine, you need to install
Microsoft Windows SDK for Windows 7 and .NET Framework 3.5 SP1
See the instructions at
http://wiki.cython.org/64BitCythonExtensionsOnWindows

The commercial Visual Studio 2008 is for Python 2.6, 2.7 and 2.8 on the 32-bit x86 setup.

0

I would avoid installing the Windows SDK and VS 2008 for this.

I believe the problem you have is due to VS 2008 not having the 64-bit compilers. To check this, find your directory containing vcvarsall.bat (search in the VS 2008 directory for it C:\Program Files (x86)\Microsoft Visual Studio 9.0). Once you've found vcvarsall.bat, open a cmd prompt in the directory it's in and type .\vcvarsall.bat amd64 If it is not the problem, you will see Setting environment for using Microsoft Visual Studio 2008 x64 tools. If this is the problem, you will get back a message saying something about configuration. This is easy to fix.

The express version of VS does not have the 64-bit compilers. The solution is to also install the SDK but is messy and unreliable so MS have provided all the compilers together in a single download: http://www.microsoft.com/en-gb/download/details.aspx?id=44266

Once you have downloaded the compilers, you can follow my post here if it doesn't work straight out the box: pyusb 2.7 windows install error

Community
  • 1
  • 1
geoff22873
  • 51
  • 4
  • Note that [link-only answers are discouraged](http://meta.stackoverflow.com/tags/link-only-answers/info), SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference. – kleopatra Feb 13 '15 at 13:59