0

I'd like to build a C++ extension for Python. I took a simple C file from a tutorial and wrote the setup.py file. But when I run the command:

python setup.py build_ext --inplace

I get the following error:

error: Unable to find vcvarsall.bat

This file is located in "c:\Program Files (x86)\Microsoft Visual Studio 12.0\vc\vcvarsall.bat" but even when I run it and set all environment variables, python.exe still tries to find it. I added this path to the PATH but it didn't solve the issue. I know this problem has been reported several times on Stack Overflow, but I haven't found any working solution.

Mark Morrisson
  • 2,543
  • 4
  • 19
  • 25
  • you need python dev headers from microsoft – YOU Jun 13 '16 at 10:24
  • First check you have the right version of Visual Studio for your version of python http://stackoverflow.com/questions/2676763/what-version-of-visual-studio-is-python-on-my-computer-compiled-with. – cdarke Jun 13 '16 at 10:25
  • I have Visual Studio 13 and the version of Python is 3.5.1. – Mark Morrisson Jun 13 '16 at 13:36

1 Answers1

0

Make sure you are using the latest version of python27 Download Microsoft visual compiler for python 2.7

In your setup script, write from setuptools import setup, Extension instead of from distutils.core import setup, Extension

refer to https://github.com/cython/cython/wiki/CythonExtensionsOnWindows for more information

Boikem
  • 39
  • 11