[Distutils] Remark concerning msvc 7.0 for c/c++ extensions for python in windows

Peter Vandersteegen Peter.Vandersteegen at intec.Ugent.be
Wed Jun 9 05:39:46 EDT 2004


I have a small remark concerning msvc 7.0 and the pre-compiled version of 
python in windows.

Recently I tried to compile the source-code for a library named PyMat, a 
link between python and matlab.
I wanted to use this library in windows with python2.3.  I tried to compile 
with microsoft visual c++ 7.0 ( NET ) and disutils.
The pre-compiled version of python 2.3 is however compiled with msvc 6.0...
This seemed to be a problem for disutils.

I recieved  following error/ following exception is raised:
"error: Python was built with version 6 of Visual Studio,  and extensions 
need to be built with the same version of the compiler, but it isn't 

Thx to google, I found the following sollution:

In $python_root$/lib/disutils/msvccompiler.py you have to comment out some 
lines (approx: line 214)
			##        if len (self.__paths) == 0:
			##            raise DistutilsPlatformError, \
			##                  ("Python was built with version %s of Visual Studio, "
			##                   "and extensions need to be built with the same "
			##                   "version of the compiler, but it isn't installed." 
% self.__version)The compiled library works correct.

The library compiled and seems to work correct!

Now my question is: is it absolutely necessary to compile everything with 
the same msvc as python is compiled with?
If not, is the line in msvccompiler.py absolutely necessary?  Could this be 
replaced with a warning, instead of raising an exception?  Simply aborting 
completely the compilation proces seems kind of drastic.

greetz and thx for reading so far


ps. I presume this problem still is present in python 2.4, 
because  msvccompiler.py still contains the conflicting lines in the 

More information about the Distutils-SIG mailing list