(2019.11.22 has been resolved) Cython error: Unable to find vcvarsall.bat
-
Cython
pass
Cython
WillPython
code toC code
and publishPython module
Error during export.i.e. through
Cython
compilepy
orpyx
document: -
background noun
- Microsoft Visual C++: referred to as Visual C++, MSVC, VC++ or VC, it is a C++ development tool under the Windows platform developed by Microsoft, with an integrated development environment, which can be used to edit and compile C, C++ and C++/CLI and other programming languages.
- Microsoft Visual Studio: referred to as VS, it is a series of development tool kits of Microsoft Corporation in the United States. It is a basically complete development tool set, including most of the tools required in the entire software life cycle, such as UML tools, code control tools , including the above integrated development environment Microsoft Visual C++.
- Internal version number: It can be seen from the above that VS contains VC, and there is a corresponding relationship between the versions. This correspondence is controlled by Microsoft's internal version. The above error message "Microsoft Visual C++ 9.0" is 9.0 It is an internal version of Microsoft Visual C++. We can find out what the corresponding VC version is based on this internal version, and what is the corresponding VS version.
The corresponding relationship between VS and VC and internal version is as follows:
VS name internal version VC name Visual Studio 4.0 Visual C++ 4.0 Visual Studio 97 5.0 Visual C++ 5.0 Visual Studio 6.0 6.0 Visual C++ 6.0 Visual Studio .NET 2002 7.0 Visual C++ 2002 Visual Studio .NET 2003 7.1 Visual C++ 2003 Visual Studio 2005 8.0 Visual C++ 2005 Visual Studio 2008 9.0 Visual C++ 2008 Visual Studio 2010 10.0 Visual C++ 2010 Visual Studio 2012 11.0 Visual C++ 2012 Visual Studio 2013 12.0 Visual C++ 2013 Visual Studio 2014 13.0 Visual C++ 2014 Visual Studio 2015 14.0 Visual C++ 2015 Visual Studio 2015 RTM 14.0 Visual C++ 2015 -
problem explanation
could not find it
vcvarsall.bat
designatedvc++
The compiler compiles. Becausewindows
under the platform,cython
is the callvc++
The compiler generatesc file
Perform bi generation and compilation to generatepyd
file.This problem is because
C compiler
The related configuration is not set.Which specific machine is required
VC++
version, see the following files:. . ./Python37/Lib/distutils/msvccompiler.py _ _ _ _ _ _ _ _ _ _
- 1
Find the following function:
which mentions,
2.3
After version, requiredVC
version insys.version
in, entercmd >> python >> import sys >> sys.version
To view:in
MSC.v
the number after1900
is to compile the currentPython
UsedVC
version information, but it is not the internal version number we are looking for, we need to find the major version number from this version informationmajorVersion
and minor version numberminorVersion
,majorVersion + minorVersion
The result is that we're looking for that build number. then here'smajorVersion
andminorVersion
How to get it? We can get from the aboveget_build_version()
Find the answer in the function:majorVersion = int ( s [ : - 2 ] ) - 6 minorVersion = int ( s [ 2 : 3 ] ) / 10.0 # s is the 1900 above majorVersion = 19 - 6 = 13 minorVersion = 00 / 10.0 = 0
- 1
- 2
- 3
- 4
- 5
So, the build number is
majorVersion + minorVersion = 13 + 0.0 = 13.0
, according to the above comparison table,correspond
VS2014
andVC2014
.Looking at the program, there is really no
2014
:But, the problem is, I can't find
VS2014
, by introducing here ,Python3.6
correspondVS2015
.Python Microsoft Visual Studio CPthon Python 2.7 Microsoft Visual Studio 2008 [MSC v.1500 64 bit (AMD64)] Python 3.4 Microsoft Visual Studio 2010 [MSC v.1600 64 bit (AMD64)] Python 3.5 Microsoft Visual Studio 2015 [MSC v.1900 64 bit (AMD64)] Python 3.6 Microsoft Visual Studio 2015 [MSC v.1900 64 bit (AMD64)] Python 3.7 Microsoft Visual Studio 2015 [MSC v.1912 64 bit (AMD64)] Be lazy first, download the smaller Visual C++ Redistributable for Visual Studio 2015 , the installation shows that it already exists, and the installation fails.
So download and install
Microsoft Visual Studio 2015
,problem solved. -
References