简体   繁体   English

无法使用 pip 安装 PyQt5

[英]Can't install PyQt5 using pip

I have tried to install PyQt5 using我尝试使用安装 PyQt5

pip install PyQt5

and

sudo -H pip install PyQt5

both of them give me the errors他们都给了我错误

ERROR: Could not find a version that satisfies the requirement PyQt5 (from versions: none)
ERROR: No matching distribution found for PyQt5

I use Ubuntu 18.04.我使用 Ubuntu 18.04。

My python version is: Python 2.7.15rc1我的python版本是:Python 2.7.15rc1


I have already installed python3-pip and tried to install PyQt5 using我已经安装了 python3-pip 并尝试使用安装 PyQt5

pip3 install PyQt5

I get the error我收到错误

Traceback (most recent call last):
  File "/usr/local/bin/pip3", line 5, in <module>
    from pkg_resources import load_entry_point
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3241, in <module>
    @_call_aside
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3225, in _call_aside
    f(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 3254, in _initialize_master_working_set
    working_set = WorkingSet._build_master()
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 585, in _build_master
    return cls._build_from_requirements(__requires__)
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 598, in _build_from_requirements
    dists = ws.resolve(reqs, Environment())
  File "/usr/local/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 786, in resolve
    raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'pip==9.0.1' distribution was not found and is required by the application

My python3 version is: Python3.6.7.我的python3版本是:Python3.6.7。

尝试这个:

python3 -m pip install PyQt5

You need to upgrade your pip你需要升级你的 pip

pip install --user --upgrade pip

Then do a fresh install然后进行全新安装

pip install PyQt5

or或者

pip3 install PyQt5

I know it is a bit late to answer.我知道现在回答有点晚了。 In PyCharm, even upgraded pip gives error in this package.在 PyCharm 中,即使升级的 pip 也会在此包中出错。 Downgraded the PyQt5 version to 5.12.2 works fine.将 PyQt5 版本降级到 5.12.2 工作正常。 Use,用,

pip install PyQt5==5.12.2 
pip install PyQtWebEngine==5.12

Or,或者,

pip3 install PyQt5==5.12.2
pip3 install PyQtWebEngine==5.12

Works fine for me.对我来说很好用。

You can run command你可以运行命令

   pip3 install PyQt5

or for Python 2 you can manually install from https://www.riverbankcomputing.com/software/pyqt/download5或者对于 Python 2,您可以从https://www.riverbankcomputing.com/software/pyqt/download5手动安装

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM