Python之Unable to find vcvarsall.bat

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"

你可能感兴趣的:(Python之Unable to find vcvarsall.bat)