为什么安装后无法在 python 中导入 Pyqt?

Why I can't import Pyqt in python after install it?

我在Python中非常菜鸟,现在我很难安装 PyQt 和 PyQwt。

我搜索了很多网站的方法,但我仍然无法摆脱这个问题。 现在我决定关注Christoph Gohlke's。 我成功地使用 pip 安装了 numpy wheel 文件并可以将其导入 python 但它不适用于 PyQt 和 PyQwt。

对于 PyQt,当我用这个通过 cmd 安装 wheel 文件时

pip install PyQt4-4.11.4-cp27-none-win_amd64.whl

出现

Requirement already satisfied (use --upgrade to upgrade): PyQt4==4.11.4 from file:///C:/Users/Mann/Downloads/PyQt4-4.11.4-cp27-none-win_amd64.whl in c:\python27\lib\site-packages

我想应该是安装成功了,所以我尝试在Python2.7

中导入PyQt4
import PyQt4

但失败并出现错误

Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import PyQt4
ImportError: No module named PyQt4

我也在 "Script" 目录中调用 pip.exe,正如 所说,但它仍然是一样的。 请帮我摆脱困境。

谢谢

您是否尝试过强制重新安装?

pip install --force-reinstall PyQt4-4.11.4-cp27-none-win_amd64.whl

pip install --upgrade --no-deps --force-reinstall PyQt4-4.11.4-cp27-none-win_amd64.whl