Windows上的python pip-命令"cl.exe"失败 [英] python pip on Windows - command 'cl.exe' failed

查看:657
本文介绍了Windows上的python pip-命令"cl.exe"失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用pip install spacy安装spaCy,但出现以下错误..

I'm trying to install spaCy using pip install spacy but I'm getting the following error ..

我安装了VS 2015,并且安装了以下Python ..

I have VS 2015 installed, and I have the following Python install ..

3.5.2 |Anaconda 2.5.0 (64-bit)| (default, Jul 5 2016, 11:41:13) [MSC v.1900 64 bit (AMD64)]

我尝试了以下SO解决方案,但无济于事.

I tried the following SO solutions to no avail ..

  • command cl.exe failed upon pip install django_compressor
  • error: command 'cl.exe' failed: No such file or directory

以及其他各种.对于这个特定的库来说,这不是一个唯一的问题,但更普遍的是,任何时候我尝试安装需要C才能在Windows上构建的Python库.

As well as various others. This is not a unique problem to this specific library but more generally anytime I try to install Python libraries that need C to build on Windows.

推荐答案

您需要在计算机和PATH中安装cl.exe(Microsoft C编译器). PATH是一个环境变量,它告诉Windows在哪里找到可执行文件.

You need to have cl.exe (the Microsoft C Compiler) installed on your computer and in your PATH. PATH is an environment variable that tells Windows where to find executable files.

首先,确保安装了用于Visual Studio的 C ++生成工具.您可以从 Visual Studio下载页面单独下载 Visual Studio生成工具. ,然后从安装程序中选择 C ++构建工具.如果您已经拥有Visual Studio,则还可以从Visual Studio安装程序中安装使用C ++进行桌面开发,您应该在开始"菜单中安装该软件.

First, ensure the C++ build tools for Visual Studio are installed. You can download Build Tools for Visual Studio separately from the Visual Studio downloads page, then choose C++ build tools from the installer. If you already have Visual Studio, you can also install Desktop development with C++ from the Visual Studio Installer which you should have in Start Menu.

然后,使用正常菜单中的开始菜单中的特殊命令提示符之一,而不是普通的命令提示符或PowerShell.对于32位Python,您可能正在寻找 x86本机工具命令提示符.这样会自动设置PATH,以便可以找到cl.exe.

Then, instead of the normal Command Prompt or PowerShell, use one of the special command prompts in the Visual Studio folder in Start Menu. For 32-bit Python, you're probably looking for x86 Native Tools Command Prompt. This sets up PATH automatically, so that cl.exe can be found.

这篇关于Windows上的python pip-命令"cl.exe"失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆