Python does not consider distutils.cfg

 ̄綄美尐妖づ 提交于 2019-12-05 06:43:37

Difficult Solution (Building using the C/C++ compiler)

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

Easier Solution (Use pre-built binaries)

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

Cost me several hours to figure this out but now works like a charm. I am on Windows 64bit and using a scientific Python distribution Enthought Canopy.

  1. Ensure you have installed MinGW and the Compilers you need (C, C++, Fortran..)

  2. Add C:\MingW\bin to your PATH in Environment variables

  3. In C:\Users\MyName\AppData\Local\Enthought\Canopy32\App\appdata\canopy-1.6.2.3262.win-x86\Lib\distutils, create with notepad++ or similiar a new file distutils.cfg

Write and save:

[build]
compiler = mingw32

[build_ext]
compiler = mingw32

Do you happen to use virtualenv as well?

Anyway, use Microsoft Visual C++ Compiler for Python 2.7 and a newer setuptools. The one bundled with virtualenv (3.6) does not support this compiler.

pip install "setuptools>=6.0"

Credits: http://blog.ionelmc.ro/2014/12/21/compiling-python-extensions-on-windows/

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!