Search code examples
pythontraitstraitsui

Can't install traits on windows, python


Windows 10 64bit

I installed traitsui successfully by pip in python3.52

Qt4 must be installed to display GUI on windows, But the highest version of python Qt4 support is python3.4

So, I install python3.4, when I try to install traits by pip

I got error message:

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

Unable to find vcvarsall.bat

I search the error message, get some results, But none of them solve the problem, So I install mingw

use pip to install traits again, get another error

collect2.exe: error: ld returned 1 exit status
error: command 'D:\\Program Files\\mingw-w64\\x86_64-5.3.0-win32-seh-rt_v4-rev0\\mingw64\\bin\\gcc.exe' failed with exit status 1

collect2.exe: error

Is there a way to install traits on windows in python 3.4?


Solution

  • You can circumvent the problem of the error with Visual Studio C++ by installing a precompiled version of the package in form of a wheel. You can find wheel packages for most of the common modules here.

    Download the file traits-4.6.0.dev0-cp34-cp34m-win32.whl (cp34 indicates Python 3.4, win32 that your Python is 32bit) and install it using the command line:

    pip install C:\whereveryourfileis\traits-4.6.0.dev0-cp34-cp34m-win32.whl
    

    Make sure that pip is linked to your Python 3.4 pip. If you are unsure, you can run the pip.exe directly by changing your directory in the command line (cd C:\Python34\Scripts) and running

    pip.exe install C:\whereveryourfileis\traits-4.6.0.dev0-cp34-cp34m-win32.whl
    

    Edit: Did you consider using Qt5?