Python 需要vcvarsall.bat
只是为了获取关于vc
的编译环境。
由于提取了Visual Studio
的编译器,所以我只要自己配置一个设置环境变量的bat
即可。
只需修改$python_path/lib/distutils/_msvccompiler.py
里的_find_vcvarsall
函数。例如:直接在函数内的首行:return 'f:/vs/x64.bat', None
。
x64.bat
@echo off
set "Path=%~dp0\vc\bin\amd64;%~dp0\sdk\bin\x64"
set "INCLUDE=%~dp0\vc\include;%~dp0\sdk\Include\ucrt;%~dp0\sdk\Include\shared;%~dp0\sdk\Include\um;%~dp0\sdk\Include\winrt;D:\software\python\include"
set "LIB=%~dp0\vc\lib\amd64;%~dp0\sdk\Lib\ucrt\x64;%~dp0\sdk\Lib\um\x64;D:\software\python\libs"