ImportError: No module named PyQt4.QtCore

前端 未结 7 1021
感情败类
感情败类 2021-02-01 18:02

I\'ve reïnstalled my ssh server, so I also need to reïnstall my Python packages.

I did that, but I still get the error:

ImportError: No module named PyQt         


        
7条回答
  •  再見小時候
    2021-02-01 18:53

    I got the same error, when I was trying to import matplotlib.pyplot

    In [1]: import matplotlib.pyplot as plt
    ...
    ...
    ImportError: No module named PyQt4.QtCore
    

    But in my case the problem was due to a missing linux library libGL.so.1

    OS : Cent OS 64 bit

    Python version : 3.5.2

    $> locate libGL.so.1
    

    If this command returns a value, your problem could be different, so please ignore my answer. If it does not return any value and your environment is same as mine, below steps would fix your problem.

    $> yum install mesa-libGL.x86_64
    

    This installs the necessary OpenGL libraries for 64 bit Cent OS.

    $> locate libGL.so.1
    /usr/lib/libGL.so.1
    

    Now go back to iPython and try to import

    In [1]: import matplotlib.pyplot as plt
    

    This time it imported successfully.

提交回复
热议问题