Python不考虑distutils.cfg

Python不考虑distutils.cfg

问题描述:

我已经尝试了所有给出的内容,并且教程都朝着将mingw用作python而不是visual c ++的编译器的方向发展.

I have tried everything given and the tutorials all point in the same direction about using mingw as a compiler in python instead of visual c++.

我确实有Visual c ++和mingw.当我想使用pip安装时,问题开始出现.它总是给Unable to find vcvarsall.bat

I do have visual c++ and mingw both. Problem started coming when I wanted to install using pip. It always gave Unable to find vcvarsall.bat

根据建议,我在以下路径c:/python27/Lib/distutils/下创建了文件distutils.cfg,并添加了以下两行:

So as per suggestions I created a file distutils.cfg under the following path c:/python27/Lib/distutils/ and added the following two lines:

[build]
compiler=mingw32

但是,该文件没有任何作用.使用pip时仍然存在相同的错误.我现在正在尝试以这种方式安装numpy,尽管该错误也是较早出现的.

However, this file has no effect whatsoever. The same error still exists while using pip. I am trying to install numpy by the way currently although the error came earlier also.

困难的解决方案(使用C/C ++编译器构建)

您使用的是Windows 32位还是64位?您在编译时指定构建吗?例如,在您的shell或bash中执行以下操作:

Are you on Windows 32bit or 64bit? Are you specifying the build when you're compiling? For example, do the following in your shell or bash:

python setup.py build --compiler==mingw32
python setup.py install

更简单的解决方案(使用预构建的二进制文件)

如果不必编译程序,则可以使用这里

If you don't have to compile the program, you can use the unofficial Windows binaries from here