【学习笔记】pip安装pyinstaller报错问题

pip 安装 pyinstaller 报错问题

PyInstaller 将 Python 应用程序及其所有依赖项捆绑到一个软件包中。 用户无需安装 Python 解释器或任何模块,即可运行打包后的应用程序。 PyInstaller 支持 Python 3.8 及更新版本,并能正确捆绑 numpy、matplotlib、PyQt、wxPython 等许多主要 Python 软件包。

PyInstaller 针对 Windows、MacOS X和Linux进行了测试。然而,它不是一个交叉编译器,要制作Windows应用,你需要在 Windows 上运行 PyInstaller,要制作 Linux 应用,你需要在 Linux 上运行它。

可以通过 pip 进行安装:

sh 复制代码
pip install pyinstaller

但是在安装时报错:

sh 复制代码
$ pip install pyinstaller
Collecting pyinstaller
  WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')"))': /packages/2a/e0/9df946cd387947176f2dd449439f8de1d6f7e41bab0a460750cf19f3ea8d/pyinstaller-6.7.0-py3-none-manylinux2014_x86_64.whl
  WARNING: Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')"))': /packages/2a/e0/9df946cd387947176f2dd449439f8de1d6f7e41bab0a460750cf19f3ea8d/pyinstaller-6.7.0-py3-none-manylinux2014_x86_64.whl
  WARNING: Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x7f72c8993b20>: Failed to establish a new connection: [Errno 111] Connection refused')': /packages/2a/e0/9df946cd387947176f2dd449439f8de1d6f7e41bab0a460750cf19f3ea8d/pyinstaller-6.7.0-py3-none-manylinux2014_x86_64.whl
  WARNING: Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')"))': /packages/2a/e0/9df946cd387947176f2dd449439f8de1d6f7e41bab0a460750cf19f3ea8d/pyinstaller-6.7.0-py3-none-manylinux2014_x86_64.whl
  WARNING: Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')"))': /packages/2a/e0/9df946cd387947176f2dd449439f8de1d6f7e41bab0a460750cf19f3ea8d/pyinstaller-6.7.0-py3-none-manylinux2014_x86_64.whl
ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Max retries exceeded with url: /packages/2a/e0/9df946cd387947176f2dd449439f8de1d6f7e41bab0a460750cf19f3ea8d/pyinstaller-6.7.0-py3-none-manylinux2014_x86_64.whl (Caused by SSLError(SSLError("bad handshake: SysCallError(104, 'ECONNRESET')")))

出现了 ERROR: Could not install packages due to an EnvironmentError: HTTPSConnectionPool 这样的错误。

重试多次后,还是这样。

修改成其他国内镜像源来下载安装,这里使用清华源:

sh 复制代码
$ pip install pyinstaller -i https://pypi.tuna.tsinghua.edu.cn/simple
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting pyinstaller
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2a/e0/9df946cd387947176f2dd449439f8de1d6f7e41bab0a460750cf19f3ea8d/pyinstaller-6.7.0-py3-none-manylinux2014_x86_64.whl (682 kB)
     |████████████████████████████████| 682 kB 744 kB/s
Collecting importlib-metadata>=4.6; python_version < "3.10"
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2d/0a/679461c511447ffaf176567d5c496d1de27cbe34a87df6677d7171b2fbd4/importlib_metadata-7.1.0-py3-none-any.whl (24 kB)
Requirement already satisfied: packaging>=22.0 in /home/hongjh/.local/lib/python3.8/site-packages (from pyinstaller) (23.2)
Collecting pyinstaller-hooks-contrib>=2024.6
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/2e/84/079d3bd411f591d825dca78b83093fcc9631ea2f887cb01fa9e19f4c619f/pyinstaller_hooks_contrib-2024.6-py2.py3-none-any.whl (339 kB)
     |████████████████████████████████| 339 kB 1.2 MB/s
Requirement already satisfied: setuptools>=42.0.0 in /usr/lib/python3/dist-packages (from pyinstaller) (45.2.0)
Collecting altgraph
  Downloading https://pypi.tuna.tsinghua.edu.cn/packages/4d/3f/3bc3f1d83f6e4a7fcb834d3720544ca597590425be5ba9db032b2bf322a2/altgraph-0.17.4-py2.py3-none-any.whl (21 kB)
Requirement already satisfied: zipp>=0.5 in /home/hongjh/.local/lib/python3.8/site-packages (from importlib-metadata>=4.6; python_version < "3.10"->pyinstaller) (3.17.0)
Installing collected packages: importlib-metadata, pyinstaller-hooks-contrib, altgraph, pyinstaller
Successfully installed altgraph-0.17.4 importlib-metadata-7.1.0 pyinstaller-6.7.0 pyinstaller-hooks-contrib-2024.6

完成下载安装。

查看版本,看是否成功安装:

sh 复制代码
$ pyinstaller --version
6.7.0

成功安装。


本文链接:https://blog.csdn.net/u012028275/article/details/139454477

相关推荐
网易独家音乐人Mike Zhou2 小时前
【卡尔曼滤波】数据预测Prediction观测器的理论推导及应用 C语言、Python实现(Kalman Filter)
c语言·python·单片机·物联网·算法·嵌入式·iot
安静读书2 小时前
Python解析视频FPS(帧率)、分辨率信息
python·opencv·音视频
冰帝海岸2 小时前
01-spring security认证笔记
java·笔记·spring
小二·3 小时前
java基础面试题笔记(基础篇)
java·笔记·python
朝九晚五ฺ5 小时前
【Linux探索学习】第十四弹——进程优先级:深入理解操作系统中的进程优先级
linux·运维·学习
小喵要摸鱼5 小时前
Python 神经网络项目常用语法
python
一念之坤6 小时前
零基础学Python之数据结构 -- 01篇
数据结构·python
wusong9996 小时前
mongoDB回顾笔记(一)
数据库·笔记·mongodb
猫爪笔记6 小时前
前端:HTML (学习笔记)【1】
前端·笔记·学习·html
Resurgence036 小时前
【计组笔记】习题
笔记