[Distutils] msvc9compiler.py - vcvarsall.bat is living one folder higher - VS90COMNTOOLS
Steve Dower
steve.dower at python.org
Tue Aug 9 19:53:00 EDT 2016
On 09Aug2016 1519, Dr. Andreas Krueger wrote:
> I could not find a github repo, otherwise I would have filed this as an
> "issue" there.
>
>
> The subfolder "VC" is wrong in msvc9compiler.py
>
> - at least on my system (win7-64bit, py2.7.12, anaconda 2.4.1, conda 4.1.11)
>
>
> So in your "msvc9compiler.py"
>
> instead of
> productdir = os.path.join(toolsdir, os.pardir, os.pardir, "VC")
>
> it needs to be
> productdir = os.path.join(toolsdir, os.pardir, os.pardir)
>
>
> Why do I say that?
> When googling the error message: "DistutilsPlatformError: Unable to
> find vcvarsall.bat", it is recommended "everywhere" on the web, to
> download "VCForPython27.msi", Microsoft Visual C++ Compiler for Python
> 2.7 http://aka.ms/vcpython27
>
>
> BUT then
>
> vcvarsall.bat
>
> ends up being in
>
> "C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++
> for Python\9.0\vcvarsall.bat"
>
> and NOT in
>
> "C:\Users\Andreas\AppData\Local\Programs\Common\Microsoft\Visual C++
> for Python\9.0\VC\vcvarsall.bat"
>
> where YOUR code is expecting it.
>
>
> Perhaps you actually want to check BOTH places, to keep compatibility
> with some older versions / different setups?
> Because I suppose, your code had worked, at some stage in the past.
>
>
> Thanks a lot!
> Andreas
>
There's actually also a requirement for a relatively recent version
(>=6.0) of setuptools in order to build correctly using the Visual C++
Compiler for Python. This will allow the compiler to be found without
using the environment variable.
I suggest ensuring that setuptools is up to date, and either import it
in the setup.py (you don't have to do anything except import it) or use
pip to install your packages.
Cheers,
Steve
More information about the Distutils-SIG
mailing list