众所周知,很多Python的库都需要编译(大概率是用了Cython),这时直接用pip安装会报错:error: Microsoft Visual C++ 14.0 is required.
不知为何,我的电脑死活不能安装上VC,只能用mingw作为编译器。
编辑你的Python路径/Lib/distutils/distutils.cfg
[build]
compiler=mingw32
[build_ext]
compiler = mingw32
// To solve the gcc error of "error: enumerator value for '__pyx_check_sizeof_voidp' is not an integer constant"
// if you install a mingw for 64bit thendefine = MS_WIN64
仍然会报错 Unknown MS Compiler version XXXX
编辑你的Python路径/Lib/distutils/cygwinccompiler.py
在elif msc_ver == '1600':
# VS2010 / MSVC 10.0 return ['msvcr100']
后添加
elif msc_ver == '1927' or msc_ver=='1929':
# MinGW64 with gcc 8.3.0 兼容 gcc version 8.1.0 (x86_64-win32-seh-rev0, Built by MinGW-W64 project)
return ['msvcr120'] # seem to be a dynamic-linker program name for command `ld`
其中1927改为你的Compiler version