简体   繁体   English

无法安装具有C依赖关系的Python库

[英]Can't Install Python Libraries with C Dependencies

I'm currently running Python 3.4 on Windows 8.1 using PyCharm Community 5.0.3 and I've been running into the following error when I try to install libraries with C dependencies (ie pymssql): 我目前正在Windows 8.1上使用PyCharm Community 5.0.3运行Python 3.4,并且在尝试安装具有C依赖项(例如pymssql)的库时遇到以下错误:

error: Microsoft Visual C++ 10.0 is required (Unable to find vcvarsall.bat)

I've gone through various Stack Overflow responses to similar situations but haven't been able to find a viable answer as most of the questions are for Python 2.7. 我已经对类似情况进行了各种Stack Overflow响应,但由于大多数问题都针对Python 2.7,因此未能找到可行的答案。 The main response I have found is to re-download Visual Studio 10, which I haven't been able to find at all on the web. 我发现的主要响应是重新下载Visual Studio 10,但我在网上根本找不到。

Any insight into this matter would be great. 对这个问题的任何见解都会很棒。

First of all you can Download Microsoft Visual 2013 Redistributable Packages from this link 首先,您可以从此链接下载Microsoft Visual 2013 Redistributable Packages

You can also use Mingw as a compiler for python 2.x and also for 3.x 您还可以将Mingw用作python 2.x和3.x的编译器

check this documentation : https://docs.python.org/2.7/install/#gnu-c-cygwin-mingw 查看此文档: https : //docs.python.org/2.7/install/#gnu-c-cygwin-mingw

This allows you to have compiler to build your extensions for your python,to use mingw as a compiler for python you have to : 这允许您让编译器为python构建扩展,要将mingw用作python的编译器,您必须:

1-install mingw32 to **C:\\programs\\mingw** 1将mingw32安装到** C:\\ programs \\ mingw **

2-Add mingw32's bin directory to your environment variable: append c:\\programs\\MinGW\\bin; 2-将mingw32的bin目录添加到您的环境变量中:追加c:\\ programs \\ MinGW \\ bin; to the PATH 路径

3-Edit ( create if not existing ) distutils.cfg file located at C: \\Python2\\Lib\\distutils\\distutils.cfg to be: 3-将位于C: \\ Python2 \\ Lib \\ distutils \\ distutils.cfg的 distutils.cfg文件( 如果不存在则创建 )编辑为:

[build]
compiler=mingw32

Now run easy_install.exe to install any module using c or c++ extensions :) 现在运行easy_install.exe以使用c或c ++扩展名安装任何模块:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM