Python - Can't Install Packages: TypeError: unorderable types: NoneType() >= str()

一笑奈何 提交于 2019-11-29 10:39:16

I solved this problem by conda install mingw in my virtual environment and then placing

[build]
compiler=msvc

in Lib\distutils\distutils.cfg

Someone recommended I try to compile a helloworld.cpp with mingw. It failed!

The instructions I was using said I only needed to install mingw32-gcc-g++. This didn't work for me. Using the MinGW Installation Manager, I added:

  • mingw-developer-toolkit
  • mingw32-base
  • msys-base
  • mingw32-gcc-g++ (already installed previously)

So the proper instructions are:

  1. Download the mingw-get-setup.exe installer from here: http://sourceforge.net/projects/mingw/files/Installer/
  2. Run it
  3. Install the packages mentioned above
  4. Add c:\mingw\bin\ to your path environment variable
  5. Goto c:\python34\Lib\distutils\ and create distutils.cfg
  6. Open the distutils.cfg and insert two lines

    [build]

    compiler=mingw32

I think that compiler=mingw32 refers to mingw32.exe executable. That file didn't exist by default for me! I had to make a copy of mingw32-c++.exe and rename it mingw32.exe.

I hope this helps someone else!

Hugo Smitter

Adding to zolointo's answer, the cython installation worked fine after following your instructions. I'm installing Kivy with Python 3.4.1 on Windows 7. Kivy requires Cython. After downloading Cython and running the installation scripts I received the following error:

Cython compilation Problem "error: Unable to find vcvarsall.bat"

Researching that error took me down the path of installing MinGW. If The MinGW installer overwhelms you with optional packages, doc, lic, bin and dlls to install. I installed the ones you mentioned above.

if you run:

python setup.py build_ext --inplace --compiler=mingw32'

you'll get a list of errors ending in:

TypeError: unorderable types: NoneType() >= str()

To fix that I followed zolointo's instructions adding MinGW to the PATH and creating a distutils.cfg file. At that point you can run the setup.py for Cython and everything works!

On Windows 7 with Python 3.42, I could solve this problem with what I found in this thread: Going to the Python34\Lib folder, typing dist-info into the search box in the upper right corner of the folder view and deleting all folders found. This already worked two times for me after I could not install anything anymore via pip without getting the error message this thread is about.

Set the compiler to the msvc (Visual Studio)

It has been tested on Windows 10 x64, Python 3.5.1.

Solution:

Set the compiler to the msvc (Visual Studio).

Create "distutils.cfg" in the "C:\Python35-32\Lib\distutils" folder with the following information

[build]
compiler=msvc

[build_ext]
compiler=msvc

Link: https://wiki.python.org/moin/WindowsCompilers

It's a reported bug in Python, see this: http://bugs.python.org/issue2698

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