错误:安装python包时需要Microsoft Visual C++ 14.0

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/47253638/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-19 18:06:20  来源:igfitidea点击:

error: Microsoft Visual C++ 14.0 is required when installing python package

pythonpython-3.xpackagec++14statsmodels

提问by AbdeAMNR

I'm trying to download the package statsmodelsby running in command prompt(admin) this command:

我正在尝试statsmodels通过在命令提示符(管理员)中运行此命令来下载软件包:

pip3 install statsmodels

and I get this error

我收到这个错误

“error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

“错误:需要 Microsoft Visual C++ 14.0。使用“Microsoft Visual C++ 构建工具”获取它:http: //landinghub.visualstudio.com/visual-cpp-build-tools

Please note that I already installed Visual Studio 2015 and I also have Visual Studio 2013 installed on my machine.

请注意,我已经安装了 Visual Studio 2015,并且我的机器上还安装了 Visual Studio 2013。

回答by ChihWei

  1. Please download Visual C++ Build Tools 2015

  2. Install the visualcppbuildtools_fullfrom 1.

  3. Please ensure below dependencies were installed: Python later then 2.6, including Python 3.x, NumPy, SciPy, Pandas, Patsy, Cython
  4. After all the dependencies and visualcppbuildtools_fullare installed, please relaunch your IDE or reboot computer.
  5. Please execute "pip3 install statsmodels" again after IDE relaunch.
  1. 请下载Visual C++ Build Tools 2015

  2. 从 1安装visualcppbuildtools_full

  3. 请确保安装了以下依赖项:Python 2.6 以后,包括 Python 3.x、NumPy、SciPy、Pandas、Patsy、Cython
  4. 安装所有依赖项和visualcppbuildtools_full 后,请重新启动您的 IDE 或重新启动计算机。
  5. 请在 IDE 重新启动后再次执行“pip3 install statsmodels”。

I'm using Windows VS code, and I found the statsmodels installation won't work unless I relaunch my VS code.

我正在使用 Windows VS 代码,我发现除非我重新启动我的 VS 代码,否则 statsmodels 安装将不起作用。

Please try it.

请尝试一下。

回答by Adnan Khan

Maybe I am too late to share a solution here but it might help someone in the future. i was also trying to setup YOLO and was trying for a complete one day to solve the VC++ error message.

也许我在这里分享解决方案为时已晚,但将来可能会对某人有所帮助。我也在尝试设置 YOLO,并尝试了整整一天来解决 VC++ 错误消息。

Command i was trying to run: python setup.py build_ext --inplaceError message everyone knows: Microsoft Visual C++ 14.0 is requiredso i google it visit many forums and tried everything, from reinstalling VC++ tools for VS2015 many times and restart my system many times, set paths in environment variables. but none worked for me...

我试图运行的命令:python setup.py build_ext --inplace错误消息大家都知道:Microsoft Visual C++ 14.0 是必需的,所以我谷歌它访问了许多论坛并尝试了一切,从多次为 VS2015 重新安装 VC++ 工具并重新启动我的系统很多次,在环境变量中设置路径。但没有一个对我有用......

what worked for me>>>>?

什么对我有用>>>>?

1: Install VC++ build tools from build-tools-for-visual-studio-2017, once you run the setup, check only Visual C++ build toolsand select all important optional check boxes on the right side. it might take more than 8 GB on your desk, then restart your system.

1:从build-tools-for-visual-studio-2017安装 VC++ 构建工具,运行安装程序后,仅选中Visual C++ 构建工具并选中右侧的所有重要可选复选框。它可能需要超过 8 GB 的空间,然后重新启动系统。

2: Add path in Environment Variables to your VC that will be: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC

2:将环境变量中的路径添加到您的 VC,即:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC

3: Also add path to: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726 with variable name: VS140COMNTOOLS

3:同时添加路径到:C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726 变量名: VS140COMNTOOLS

4:Once its done type Native Toolsin windows start menu. you should see X64 Native Tools Command Prompt for VS2017click on it, it will open a command prompt, run your command again inside this command prompt not in regular windows command prompt.

4:完成后,在 Windows 开始菜单中键入Native Tools。你应该看到X64 Native Tools Command Prompt for VS2017点击它,它会打开一个命令提示符,在这个命令提示符下再次运行你的命令,而不是在常规的 Windows 命令提示符下。

I hope it will work for you.

我希望它对你有用。