简体   繁体   中英

Can't install PyQt5 using pip

I have tried to install PyQt5 using

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.

My python version is: Python 2.7.15rc1


I have already installed python3-pip and tried to install PyQt5 using

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 -m pip install PyQt5

You need to upgrade your 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. Downgraded the PyQt5 version to 5.12.2 works fine. 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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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