Windows下pip安装quickfix失败,已装VC++构建工具仍报错求助
问题重现
安装时出现以下错误:
python setup.py bdist_wheel did not run successfully
exit code: 1
[7 lines of output]
Testing for std::tr1::shared_ptr...
...not found
Testing for std::shared_ptr...
...not found
Testing for std::unique_ptr...
...not found
error: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-build-tools
已安装Microsoft C++构建工具但问题依旧,可尝试以下方案:
确认VC++构建工具组件完整
打开Visual Studio Installer,检查是否勾选了「Desktop development with C++」工作负载,同时确保勾选了该工作负载下的:- MSVC v143 - VS 2022 C++ x64/x86 build tools(版本≥14.0即可,推荐最新版)
- Windows SDK(选择与当前Windows系统匹配的版本)
若有缺失,点击「修改」完成组件安装。
使用VC++专属命令提示符执行安装
找到Visual Studio安装目录下的「x64 Native Tools Command Prompt for VS 2022」(如果是32位Python则选x86版本),打开该命令行窗口后,再运行pip install quickfix或python setup.py install,确保Python调用到正确的编译环境。匹配Python与VC++工具的架构
确认你的Python是x64还是x86版本,对应的VC++构建工具必须安装同架构的编译组件。例如64位Python需要安装x64的MSVC构建工具。强制指定编译器版本
在命令行中设置环境变量后再执行安装:set MSVC_VERSION=143 set DISTUTILS_USE_SDK=1 pip install quickfix尝试预编译wheel包
若源码编译始终失败,可寻找适配Python 3.12.2的Windows版quickfix预编译wheel包,下载后用pip install 【wheel文件名】直接安装,跳过编译步骤。
内容的提问来源于stack exchange,提问作者dGayand

