尝试在具有PyCharm的Mac OS上安装PyQtWebEngine

时间:2020-05-17 16:06:46

标签: python python-3.x

我对此很陌生,不确定该怎么做。在PyCharm中运行文件时,出现以下消息:

File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/aqt/qt.py", line 16, in <module>
    from PyQt5.QtWebEngineWidgets import *  # type: ignore
ModuleNotFoundError: No module named 'PyQt5.QtWebEngineWidgets'

所以我去了文件夹:

/Library/Frameworks/Python.framework/Versions/3.8

我输入了这个:

python get-pip.py
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

Defaulting to user installation because normal site-packages is not writeable
Collecting pip
  Using cached pip-20.1-py2.py3-none-any.whl (1.5 MB)
Installing collected packages: pip
  Attempting uninstall: pip
    Found existing installation: pip 20.1
    Uninstalling pip-20.1:
      Successfully uninstalled pip-20.1
  WARNING: The scripts pip, pip2 and pip2.7 are installed in '/Users/al/Library/Python/2.7/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
  NOTE: The current PATH contains path(s) starting with `~`, which may not be expanded by all applications.

并尝试输入此内容:

% pip install PyQtWebEngine
zsh: command not found: pip

有人可以给我一些建议,告诉我我做错了什么,为什么即使我在3.8文件夹中,它也使用Python 2?

1 个答案:

答案 0 :(得分:0)

我不确定我是否理解您的问题,但是如果我回答您所认为的话。请告诉我我是否理解错了。 因此,您可以在命令提示符下输入:pip install PyQtWebEngine 我不认为这很重要,但还是要这样做。 然后,如果您有PyCharm(操作方法),请转至文件然后设置。在设置中转到 项目:_______(<-项目名称)。按下它左边的箭头。然后转到Project Interpreter并单击它。在这里,您会看到所有已安装的程序包。因此,您没有PyQtWebEngine。转到右侧的+按钮。 然后,您将必须搜索所需的任何软件包(现在为:PyQtWebEngine),然后按一下它。然后,在该窗口的最下方,您将看到“安装软件包”按钮,然后按在它上面。片刻之后(时间取决于您的计算机),它将被安装。您可以安装所有您不需要的软件包。我不知道,也许只是我一个人,以防万一,这是我不想告诉你的: 如果开始新项目,则可能必须再次安装软件包(必须安装)。 希望我能解决您的问题:)