2011-01-08 80 views
2

我有一臺Win7 x64機器上運行的Python 2.6和Visual Studio 2008。 當我嘗試建立在C「example_nt」的基本Python擴展例如在蟒蛇2.6源代碼分發發現,它失敗:試圖構建基本的python擴展示例失敗(windows)

python setup.py build 

,這導致:

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'] 

我能要解決這個問題嗎?任何幫助將不勝感激

+1

確保您從具有適當環境變量集的「Visual Studio命令提示符」運行,並且您正在使用的Python版本與比特位(32/64)匹配,的編譯器。 – 2011-01-08 19:47:16

+0

這是http://stackoverflow.com/questions/4624507 – cgohlke 2011-01-09 01:36:22

回答

3

對於Win7的X64機的Python 2.6(x64)的機器,您需要安裝
的Microsoft Windows SDK的Windows 7和.NET Framework 3.5 SP1
看到
http://wiki.cython.org/64BitCythonExtensionsOnWindows

的說明

商業Visual Studio 2008適用於32位x86設置上的Python 2.6,2.7和2.8 。

0

我會避免爲此安裝Windows SDK和VS 2008。

我相信你的問題是由於VS 2008沒有64位編譯器。要檢查它,找到包含vcvarsall.bat的目錄(在VS 2008目錄中搜索C:\ Program Files(x86)\ Microsoft Visual Studio 9.0)。找到vcvarsall.bat後,在其所在的目錄中打開cmd提示符,然後鍵入.\vcvarsall.bat amd64 如果不是問題,您將會看到Setting environment for using Microsoft Visual Studio 2008 x64 tools. 如果這是問題,您將收到一條消息,提示有關配置的信息。這很容易解決。

VS的高級版沒有64位編譯器。解決方案是也安裝SDK,但是很麻煩,不可靠,所以MS已經在一次下載中提供了所有的編譯器:http://www.microsoft.com/en-gb/download/details.aspx?id=44266

一旦你下載了編譯器,如果它不起作用直接出箱: pyusb 2.7 windows install error