如何离线安装 C++ 14.0 并让 python 知道它?

How to install C++ 14.0 Offline and make python aware of it?

我正在尝试使用其他 Whosebug 问答中的建议弄清楚如何离线安装 c++ 14.0。但其中 none 似乎有效。我需要它用于 Cython。我不想安装二进制版本。我安装了建议的可再发行组件,然后重新启动服务器以正确应用路径,但是当我 pip install cython.tar 它仍然找不到 c++ 14.0 依赖项。任何帮助将不胜感激。

以下是我根据其他 Whosebug 答案安装的内容的链接:

微软构建工具 2015:https://www.microsoft.com/en-za/download/details.aspx?id=48159

Windows 10 SDK ISO: https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk

然后我重新启动了 windows 服务器,我什至 运行 一些其他答案建议的以下命令: python -m pip install setuptools --upgrade

根据this site, "Another option is to use Microsoft’s Visual C. One must then use the same version which the installed Python was compiled with." It's likely you're not on a matching version. Cython itself recommends MinGW, which is easy enough to install following the directions on their site. Just make sure the compiler and standard library are in your Windows PATH. I believe they have to be added manually, which is pretty easy in Windows 10

经过数月的研究和尝试各种方法后,以下方法奏效了:

第 1 步:下载您选择的 build_tools.exe

第 2 步:确保您所在的计算机具有与要安装 c++ 依赖项的环境完全相同的计算机。即,如果服务器是 windows 服务器 2016 64 位 运行 虚拟机来模拟那个确切的环境。

第 3 步:转到此站点以获取您可以在下一步中下载的所有可能组件的列表 - https://docs.microsoft.com/en-us/visualstudio/install/workload-component-id-vs-community?view=vs-2019

第 4 步:按照以下说明获取您选择的本地缓存下载 - https://docs.microsoft.com/en-us/visualstudio/install/create-an-offline-installation-of-visual-studio?view=vs-2019

第 5 步:将所有内容复制到服务器并继续按照第 4 步的说明进行操作

第 6 步:重启机器以正确应用路径

第 7 步:将 rc.exe 和 rcdll.dll 从 C:\Program Files (x86)\Windows Kits.0\bin\x86 复制到 C:\程序文件 (x86)\Microsoft Visual Studio 11.0\VC\bin

第 8 步:从 pypi.org

下载最新的设置工具

第 9 步:运行 具有管理员权限的以下命令 python -m pip install path/to/setuptools.tar --upgrade

第 10 步:再次重启计算机以应用路径。

完成所有步骤后,c++ 14.0(或您选择的)将正确安装并链接,不会出现任何问题。

  1. 下载visualcppbuildtools_full.exe文件并执行。

  2. 取消选中所有复选框。

  3. 将显示安装按钮,单击它。

重启电脑,大功告成

安装 chocolatey,然后使用他们的脚本安装 Visual Studio 2019 构建工具,最好使用以下命令:

choco install visualstudio2019buildtools --package-parameters "--allWorkloads --includeRecommended --includeOptional --passive --locale en-US"

之后您将看到 Visual Studio GUI 安装程序,您可以在其中手动 select 需要的软件包(注意大小)

来源:https://chocolatey.org/packages/visualstudio2019buildtools