0

I have Visual Studio 2012 installed and am trying to build my C Python module which has a setup.py. I am the author of the module, found here: https://github.com/patrickkidd/pyrtmidi. Is this possible with Python 3.4? I've been out of the Python world for several years.

Thanks!

patrickkidd
  • 2,797
  • 2
  • 19
  • 19
  • I will add that I get this error with Python-3.4.1 and Visual Studio 2012 Ultimate: error: Unable to find vcvarsall.bat. This is using the Visual Studio developer command prompt. – patrickkidd Oct 01 '14 at 19:20
  • Here is a pretty good run-through of this question: http://stackoverflow.com/questions/11267463/compiling-python-modules-on-win-x64 – patrickkidd Oct 01 '14 at 19:40

2 Answers2

2

You need to compile extensions with the same version of MSVC that CPython itself is using. Which version of VS you're using is irrelevant if you can make it work with the corresponding version of toolchain.

Building C and C++ Extensions on Windows docs chapter has step-by-step instructions regarding the specifics.

Community
  • 1
  • 1
ivan_pozdeev
  • 33,874
  • 19
  • 107
  • 152
  • So does the last link mean to say that the latest version of python (3.4.1) is built with Visual Studio 2010? Or is there another way to find out what version of VS a particular version of Python is built with? The link to set the preferred toolchain only applies to having a specific project/solution set up, but I can't find the global settings for VS 2012. Then, once I do have the right toolchain set, will it solve this error: "Unable to find vcvarsall.bat"? – patrickkidd Oct 01 '14 at 19:28
  • I found this: http://stackoverflow.com/questions/2676763/what-version-of-visual-studio-is-python-on-my-computer-compiled-with – patrickkidd Oct 01 '14 at 19:37
  • The link in the comment answers your first question. "Unable to find vcvarsall.bat" is in `distutils` logic and you said you gonna build with VS (but anyway, there's an exhaustive explanation @ http://stackoverflow.com/q/6551724/648265 and, 4 x64, @ http://stackoverflow.com/a/18045219/648265 ) An SDK seems to be as valid as a VS as long as _MSC_VER is coherent. – ivan_pozdeev Oct 02 '14 at 20:18
  • I am trying to build from the command line, but anyway I think we took enough stabs at this that this page has the answers for the next person who is looking for this answer. It's funny how many times I have googled for an answer to this same question over the years, and how the answer is always the same but the specifics change slightly as the versions of Python and VS progress. Cheers, Ivan. – patrickkidd Oct 02 '14 at 21:15
0

Thank you Ivan for the tips.

Here is a pretty good run-through of this question: Compiling Python modules on Windows x64

This should be the correct compiler for Python-3.4.1 which uses VS 2010 toolchain (note SDK version 7.1 in the "Details" tab): http://www.microsoft.com/en-us/download/details.aspx?id=8279

Community
  • 1
  • 1
patrickkidd
  • 2,797
  • 2
  • 19
  • 19