【发布时间】:2020-11-20 14:50:15
【问题描述】:
我 pip 安装了 PyQt5,并在我的 CMD 中使用 pip show PyQt5 验证了这一点,这给了我:
C:\Users\92175>pip show PyQt5
Name: PyQt5
Version: 5.15.0
Summary: Python bindings for the Qt cross platform application toolkit
Home-page: https://www.riverbankcomputing.com/software/pyqt/
Author: Riverbank Computing Limited
Author-email: info@riverbankcomputing.com
License: GPL v3
Location: c:\python\python37-32\lib\site-packages
Requires: PyQt5-sip
Required-by:
当我在 PyCharm 中运行我的代码时,from PyQt5 import QtWidgets, QtCore, QtGui... 出现错误
ModuleNotFoundError: No module named 'PyQt5'
我在另一个地方看到了同样的问题:ImportError: No module named PytQt5,但这有点不同,因为我既没有使用 Ubuntu,也没有使用 bash。
我是否需要打扰我的 IT 人员并请他帮我修改PYTHONPATH? (我认为这需要管理员权限)。如果是这样,我该怎么做?或者有没有办法从我的代码中将 PyCharm 引导到 PyQt5 的位置?
【问题讨论】:
-
一切都好。这就是说你没有“位置”包。
pip show首先尝试查找包location- 你没有它,然后它列出pyqt5 -
你确定pycharm使用的是你安装pyqt5的python吗?
-
@eyllanesc 好问题。我会努力找出答案的!
-
@eyllanesc -- 所以我去了 PyCharm > Settings > Project > Project Interpreter > +Package > 搜索并选择 PyQt5 并点击
Install Package> 这给了我一个错误:Could not fetch URL https://pypi.org/simple/pyqt5/: There was a problem confirming the ssl certificate: ...PyCharm 也建议:“尝试从系统终端运行此命令。”我已经这样做了。我现在应该尝试什么?