2014-10-01 27 views
0

我安裝了Visual Studio 2012,並且正在嘗試構建具有setup.py的C Python模塊。我是該模塊的作者,在這裏找到:https://github.com/patrickkidd/pyrtmidi。這可能與Python 3.4?我已經離開了Python世界好幾年了。用Visual Studio 2012和setup.py構建python模塊?

謝謝!

+0

我會補充說我得到這個錯誤與Python-3.4.1和Visual Studio 2012旗艦版:錯誤:無法找到vcvarsall.bat。這是使用Visual Studio開發人員命令提示符。 – patrickkidd 2014-10-01 19:20:43

+0

下面是這個問題的一個很好的運行:http://stackoverflow.com/questions/11267463/compiling-python-modules-on-win-x64 – patrickkidd 2014-10-01 19:40:20

回答

2

您需要編譯擴展with the same version of MSVC that CPython itself is using。如果你可以使用make it work with the corresponding version of toolchain,你使用哪個版本的VS是無關緊要的。

Building C and C++ Extensions on Windows docs章節有關於具體的分步說明。

+0

所以最後一個鏈接的意思是說,最新版本的python(3.4.1)是用Visual Studio 2010構建的嗎?還是有另一種方法來找出VS的特定版本是用什麼版本的VS構建的?設置首選工具鏈的鏈接僅適用於設置特定項目/解決方案,但我無法找到VS 2012的全局設置。然後,一旦我確實設置了正確的工具鏈,它是否會解決此錯誤:「無法找到vcvarsall.bat「? – patrickkidd 2014-10-01 19:28:17

+0

我發現這個:http://stackoverflow.com/questions/2676763/what-version-of-visual-studio-is-python-on-my-computer-compiled-with – patrickkidd 2014-10-01 19:37:48

+0

評論中的鏈接回答你的第一個問題。 「無法找到vcvarsall.bat」在'distutils'邏輯中,你說你會用VS構建(但無論如何,這裏有詳盡的解釋@ http://stackoverflow.com/q/6551724/648265和4 x64,@ http://stackoverflow.com/a/18045219/648265)只要_MSC_VER是連貫的,SDK似乎與VS一樣有效。 – 2014-10-02 20:18:43