使用Microsoft Visual Build Tools 2017从源安装Python软件包



我有一个python软件包,该软件包无法安装适合Windows构建工具的依赖。

我尝试过的事情:

  1. 安装最新版本的Visual Studio 2017(AFAIK它应该包含Microsoft Visual C 14.0(。

  2. 直接从此处https://www.visualstudio.com/downloads/#build-tools-for-visual-visual-studio-2017。

  3. C:Program Files (x86)Microsoft Visual Studio2017BuildTools明确地放在我的路径上。

  4. 卸载所有Visual Studio,然后重试。

到目前为止没有运气。我尝试重新启动终端,重新启动计算机等...我正在使用Gitbash,这可能是相关的,尽管否则这从来没有给我带来任何问题。

当我安装工具时,我确保检查" Visual C 构建工具"工作流程,该工作流选择了"单个组件"选项卡下的许多订单项的某些子集。

在下面的示例中,我正在安装语言模型,但我相信我的问题比这更笼统。我发现很难理解与我的任务相关的许多组件中的哪一个。我想知道的是:如何验证我的构建工具是否正确配置并且具有正确的版本?这里的任何建议或指导将不胜感激。

错误:

$ pip36 install https://github.com/kpu/kenlm/archive/master.zip
Collecting https://github.com/kpu/kenlm/archive/master.zip
  Downloading https://github.com/kpu/kenlm/archive/master.zip (526kB)
Installing collected packages: kenlm
  Running setup.py install for kenlm: started
    Running setup.py install for kenlm: finished with status 'error'
    Complete output from command c:usersks99999999appdatalocalprogramspythonpython36-32python.exe  -u -c "import setuptools, tokenize;__file__='C:\Users\ks99999999\AppData\Local\Temp\pip-tfn5ym94-b uild\setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close ();exec(compile(code, __file__, 'exec'))" install --record C:Usersks99999999AppDataLocalTemppip-r2e ogfmd-recordinstall-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'kenlm' extension
    error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http: //landinghub.visualstudio.com/visual-cpp-build-tools
    ----------------------------------------
Command "c:usersks99999999appdatalocalprogramspythonpython36-32python.exe -u -c "import setuptool s, tokenize;__file__='C:\Users\ks99999999\AppData\Local\Temp\pip-tfn5ym94-build\setup.py';f=getatt r(tokenize, 'open', open)(__file__);code=f.read().replace('rn', 'n');f.close();exec(compile(code, __ file__, 'exec'))" install --record C:Usersks99999999AppDataLocalTemppip-r2eogfmd-recordinstall-rec ord.txt --single-version-externally-managed --compile" failed with error code 1 in C:Usersks99999999Ap pDataLocalTemppip-tfn5ym94-build

Microsoft Visual Studio不会使用任何VC编译器(或任何编译器(运输外部。您的安装是模块化的,因此您必须确保在安装VS2017的安装中安装了视觉C 。此外,IIRC,VS2017带有Microsoft Visual C 15.0船。您可以使用独立的Microsoft Visual Studio 2015构建工具安装14.0编译器。确保您也具有正确的Setuptools版本。

您可以通过查看开始菜单 ->添加/删除程序并在已安装程序的列表中检查哪个版本的MSVC。

最新更新