简体   繁体   English

FileNotFoundError 安装 PyQt5

[英]FileNotFoundError Installing PyQt5

I'm been trying to install PyQt and I can't get past the below error.我一直在尝试安装 PyQt 并且无法通过以下错误。 I've read a few posts suggesting that I should upgrade PIP, setup_tools, and ez_install.我读过一些帖子,建议我应该升级 PIP、setup_tools 和 ez_install。 I've tried all of that with no luck.我已经尝试了所有这些,但没有运气。 Any tips?有小费吗?

c:\Python27>pip install PyQt5_gpl-5.10.tar.gz
Processing c:\python27\pyqt5_gpl-5.10.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "c:\program files (x86)\python36-32\lib\tokenize.py", line 452, in open
    buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\JAME~1.KRK\\AppData\\Local\\Temp\\pip-0u8uht47-build\\setup.py'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\JAME~1.KRK\AppData\Local\Temp\pip-0u8uht47-build\           

Same thing in 3.6:在 3.6 中也是一样的:

c:\Program Files (x86)\Python36-32>pip install PyQt5_gpl-5.10.tar.gz
Processing c:\program files (x86)\python36-32\pyqt5_gpl-5.10.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
     File "<string>", line 1, in <module>
     File "c:\program files (x86)\python36-32\lib\tokenize.py", line 452, in open
        buffer = _builtin_open(filename, 'rb')
    FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\JAME~1.KRK\\AppData\\Local\\Temp\\pip-f9s0_6sp-build\\setup.py'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in 
C:\Users\JAM~1.KRK\AppData\Local\Temp\pip-f9s0_6sp-build\

I just encountered the same issue and find clue in the topic.我刚刚遇到了同样的问题,并在该主题中找到了线索。 It has been solved by pip upgrade.已经通过pip升级解决了。

Here is the detail:这是详细信息:

1. Issue case: 1.问题案例:

pip3 install pyqt5. pip3 安装 pyqt5。

failed and report FileNotFoundError: [Errno 2] No such file or directory:失败并报告 FileNotFoundError: [Errno 2] No such file or directory:

2. OS environment: 2.操作系统环境:

Win10 64x WSL2

3. Python environment 3.Python环境

python 3.7.3

pip version 19.X (not write down)

Solved steps:解决步骤:

  1. pip3 install --upgrade pip pip3 install --upgrade pip
  2. pip3 install --user PyQt5 pip3 安装 --user PyQt5
  3. sudo apt-get update -y须藤 apt-get 更新 -y
  4. sudo apt install libgl1-mesa-glx -y sudo apt install libgl1-mesa-glx -y

now.现在。 It works.它有效。

Root cause:根本原因:

a. a. pyqt in wsl, pip old version download wrong package. wsl中的pyqt ,pip老版本下载错误包。 pip (v20.x) download below version PyQt5-5.15.2-5.15.2-cp35.cp36.cp37.cp38.cp39-abi3-manylinux2014_x86_64.whl pip (v20.x) 下载以下版本 PyQt5-5.15.2-5.15.2-cp35.cp36.cp37.cp38.cp39-abi3-manylinux2014_x86_64.whl

b.libgl1.so1. libgl1.so1。 not such lib need install by apt intall不需要通过 apt intall 安装这样的库

Hope my experience can help you.希望我的经验可以帮到你。

On PyPI it seems PyQT5 is for python 3.5 or higher only.PyPI 上,PyQT5 似乎仅适用于 python 3.5 或更高版本。 Not python 2.7.不是python 2.7。 Use an earlier version of PyQt or a newer version of python (Python 2.7 isn't supported beyond 2020, you'll need to move sooner or later).使用较早版本的 PyQt 或较新版本的 python(2020 年以后不支持 Python 2.7,您迟早需要移动)。

You appear to be trying to make pip install the PyQt5 source archive .您似乎正在尝试使pip install the PyQt5 source archive PyQt doesn't use the usual setup.py script that many python packages use and cannot be built and installed from source with pip . PyQt不使用许多 python 包使用的常用setup.py脚本,并且无法使用pip从源代码构建和安装。 Furthermore, the .tar.gz format is intended for linux systems and Windows provides no native support.此外, .tar.gz格式适用于 linux 系统,Windows 不提供本机支持。 I am not sure whether pip on Windows would even handle the format.我不确定 Windows 上的pip是否会处理这种格式。 There is a .zip version provided for Windows users.为 Windows 用户提供了一个.zip版本。

You need to either extract the archive and build from source , or allow pip to download and install the package itself with pip install PyQt5 .您需要提取存档并从源代码构建,或者允许pip使用pip install PyQt5下载并安装包本身。

If you are using Python < 3.5, you will have to build from source (or install PyQt4 instead), as there are no official builds provided for these versions of Python.如果您使用 Python < 3.5,则必须从源代码构建(或安装PyQt4 ),因为没有为这些版本的 Python 提供官方构建。 For everything else the pip command above should be enough.对于其他一切,上面的pip命令应该足够了。

您需要使用 Python >= 3.5 或尝试使用较旧的 PyQt4

on debianoids there is a nice way out of this bug在 debianoids 上有一个很好的方法来解决这个错误

apt install python3-pyqt5

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

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