Building a python extension on Windows

Christopher Wilcox chris at crwilcox.com
Tue Oct 27 14:06:41 EDT 2015


If you are building c extensions on windows with 2.7 you need to get the matching compiler from http://aka.ms/vcpython27. You should also make sure you are running the latest setup tools. If you are using 2.7.10 you should have them already. Finally, I suggest using ‘pip install .’ instead of ‘python setup.py install’. You can get setup.py install to work on your machine with some configuration, but pip install will just work.

So, in summary, run the following from the PC directory:
pip install setuptools –upgrade
pip install .

-Chris


From: Ken Brooks
Sent: Tuesday, October 27, 2015 5:09
To: python-list at python.org
Cc: Ken Brooks
Subject: Building a python extension on Windows


I checked out a copy of svn.python.org/projects/stackless/trunk because it seems to have a good sample project (PC/example_nt) for building a Python extension on Windows. That directory has a Microsoft Visual C++ solution file which can be updated to my Visual C++ version (8, of 2005).
First I tried cd-ing to that directory, as they recommend, and saying "python setup.py install". The result? A very common complaint, "Unable to find vcvarsall.bat". A search using Windows would suggest that that file doesn't exist anywhere on my system.
So I followed the VC++ build instructions, and copied the example_nt directory up one level in the tree before building it. But when I actually try to build the solution it wants to look in the PCBuild directory for python27.lib, which isn't there. Nor can I find that library anywhere else.
What gives? Is this project somehow hopelessly out of date? And more to the point, can someone direct me to a nice, fresh example project that will build a little Python extension on Windows?
Thanks,
Ken
 


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20151027/be01e5ac/attachment.html>


More information about the Python-list mailing list