当前位置:网站首页>5.4 Pyinstaller库安装与使用
5.4 Pyinstaller库安装与使用
2022-07-23 05:43:00 【亲自巡山的大王】
Pyinstaller库:将.py源代码封装成可执行文件
Pyinstaller库使用
在.py文件目录下使用cmd命令
生成可执行文件命令
pyinstaller -F xx.py

清理打包临时文件
pyinstaller --clean xx.py
指定打包程序的图标文件icon
pyinstaller -i <图标文件名.ico> -F xx.py

Pyinstaller库安装
pip install pyinstaller
报错
Collecting pyinstaller
Downloading pyinstaller-5.2-py3-none-win32.whl (1.1 MB)
|▌ | 20 kB 8.8 kB/s eta 0:02:05ERROR: Exception:
Traceback (most recent call last):
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 438, in _error_catcher
yield
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 519, in read
data = self._fp.read(amt) if not fp_closed else b""
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read
data = self.__fp.read(amt)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\http\client.py", line 464, in read
s = self.fp.read(amt)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\socket.py", line 705, in readinto
return self._sock.recv_into(b)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\ssl.py", line 1273, in recv_into
return self.read(nbytes, buffer)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\ssl.py", line 1129, in read
return self._sslobj.read(len, buffer)
TimeoutError: The read operation timed out
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\cli\base_command.py", line 173, in _main
status = self.run(options, args)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\cli\req_command.py", line 203, in wrapper
return func(self, options, args)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\commands\install.py", line 315, in run
requirement_set = resolver.resolve(
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\resolution\resolvelib\resolver.py", line 94, in resolve
result = self._result = resolver.resolve(
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 472, in resolve
state = resolution.resolve(requirements, max_rounds=max_rounds)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 341, in resolve
self._add_to_criteria(self.state.criteria, r, parent=None)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\resolvelib\resolvers.py", line 172, in _add_to_criteria
if not criterion.candidates:
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\resolvelib\structs.py", line 151, in __bool__
return bool(self._sequence)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 140, in __bool__
return any(self)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 128, in <genexpr>
return (c for c in iterator if id(c) not in self._incompatible_ids)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\resolution\resolvelib\found_candidates.py", line 32, in _iter_built
candidate = func()
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\resolution\resolvelib\factory.py", line 204, in _make_candidate_from_link
self._link_candidate_cache[link] = LinkCandidate(
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 295, in __init__
super().__init__(
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 156, in __init__
self.dist = self._prepare()
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 227, in _prepare
dist = self._prepare_distribution()
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\resolution\resolvelib\candidates.py", line 305, in _prepare_distribution
return self._factory.preparer.prepare_linked_requirement(
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\operations\prepare.py", line 508, in prepare_linked_requirement
return self._prepare_linked_requirement(req, parallel_builds)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\operations\prepare.py", line 550, in _prepare_linked_requirement
local_file = unpack_url(
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\operations\prepare.py", line 239, in unpack_url
file = get_http_url(
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\operations\prepare.py", line 102, in get_http_url
from_path, content_type = download(link, temp_dir.path)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\network\download.py", line 145, in __call__
for chunk in chunks:
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\cli\progress_bars.py", line 144, in iter
for x in it:
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_internal\network\utils.py", line 63, in response_chunks
for chunk in response.raw.stream(
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 576, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 512, in read
with self._error_catcher():
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\contextlib.py", line 153, in __exit__
self.gen.throw(typ, value, traceback)
File "C:\Users\kai\AppData\Local\Programs\Python\Python310-32\lib\site-packages\pip\_vendor\urllib3\response.py", line 443, in _error_catcher
raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
WARNING: You are using pip version 21.2.3; however, version 22.1.2 is available.
You should consider upgrading via the 'C:\Users\kai\AppData\Local\Programs\Python\Python310-32\python.exe -m pip install --upgrade pip' command.
解决办法
python -m pip install -U pip
Requirement already satisfied: pip in c:\users\kai\appdata\local\programs\python\python310-32\lib\site-packages (21.2.3)
Collecting pip
Downloading pip-22.1.2-py3-none-any.whl (2.1 MB)
|████████████████████████████████| 2.1 MB 111 kB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.2.3
Uninstalling pip-21.2.3:
Successfully uninstalled pip-21.2.3
Successfully installed pip-22.1.2
pip install pyinstaller
Requirement already satisfied: pip in c:\users\kai\appdata\local\programs\python\python310-32\lib\site-packages (21.2.3)
Collecting pip
Downloading pip-22.1.2-py3-none-any.whl (2.1 MB)
|████████████████████████████████| 2.1 MB 111 kB/s
Installing collected packages: pip
Attempting uninstall: pip
Found existing installation: pip 21.2.3
Uninstalling pip-21.2.3:
Successfully uninstalled pip-21.2.3
Successfully installed pip-22.1.2
C:\Users\kai>pip install pyinstaller
Collecting pyinstaller
Downloading pyinstaller-5.2-py3-none-win32.whl (1.1 MB)
---------------------------------------- 1.1/1.1 MB 25.5 kB/s eta 0:00:00
Requirement already satisfied: setuptools in c:\users\kai\appdata\local\programs\python\python310-32\lib\site-packages (from pyinstaller) (57.4.0)
Collecting pywin32-ctypes>=0.2.0
Downloading pywin32_ctypes-0.2.0-py2.py3-none-any.whl (28 kB)
Collecting pefile>=2022.5.30
Downloading pefile-2022.5.30.tar.gz (72 kB)
---------------------------------------- 72.9/72.9 kB 18.8 kB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Collecting altgraph
Downloading altgraph-0.17.2-py2.py3-none-any.whl (21 kB)
Collecting pyinstaller-hooks-contrib>=2021.4
Downloading pyinstaller_hooks_contrib-2022.8-py2.py3-none-any.whl (239 kB)
---------------------------------------- 239.8/239.8 kB 11.5 kB/s eta 0:00:00
Collecting future
Downloading future-0.18.2.tar.gz (829 kB)
---------------------------------------- 829.2/829.2 kB 21.8 kB/s eta 0:00:00
Preparing metadata (setup.py) ... done
Using legacy 'setup.py install' for pefile, since package 'wheel' is not installed.
Using legacy 'setup.py install' for future, since package 'wheel' is not installed.
Installing collected packages: pywin32-ctypes, altgraph, pyinstaller-hooks-contrib, future, pefile, pyinstaller
Running setup.py install for future ... done
Running setup.py install for pefile ... done
Successfully installed altgraph-0.17.2 future-0.18.2 pefile-2022.5.30 pyinstaller-5.2 pyinstaller-hooks-contrib-2022.8 pywin32-ctypes-0.2.0
边栏推荐
- 【AUTOSAR COM 4.Com服务层模块的介绍】
- 钢结构基本原理复习
- 2021信息科学Top10发展态势。深度学习?卷积神经网络?
- 高电压技术基础知识
- Using or tools to solve the path planning problem with capacity constraints (CVRP)
- Interpretation of the paper: "i4mc deep: intelligent prediction of N4 methylcytosine sites using deep learning methods with chemical properties"
- Interpretation of the paper: recognition of enhancer promoter interactions with neural networks based on pre trained DNA vectors and attention mechanisms
- 高电压技术学习总结
- 怎么建立数据分析思维
- Interpretation of the paper: DNA enhancer sequence recognition transformer structure based on Bert and two-dimensional convolutional neural network
猜你喜欢

单片机学习笔记6--中断系统(基于百问网STM32F103系列教程)
![[CAN总线的物理层 ]1.CAN/CANFD采样的点的内容分享](/img/e4/0b709a6ed5e639a75e0506f6eac9fd.png)
[CAN总线的物理层 ]1.CAN/CANFD采样的点的内容分享

NLP自然语言处理-机器学习和自然语言处理介绍(一)

高分子合成工艺学

Green data center: comprehensive analysis of air-cooled GPU server and water-cooled GPU server

论文解读:《开发一种基于多层深度学习的预测模型来鉴定DNA N4-甲基胞嘧啶修饰》

深度卷积生成对抗网络

Deep convolution generation countermeasure network

Six trends and eight technologies of high-performance computing in data centers under "data center white paper 2022" and "computing from the east to the west"

CPC客户端的安装教程
随机推荐
时间序列的数据分析(一):主要成分
数据分析(一)
预处理指令#define,你真的懂了吗?
利用pycaret:低代码,自动化机器学习框架解决回归问题
ARM架构与编程1--LED闪烁(基于百问网ARM架构与编程教程视频)
Data analysis of time series (III): decomposition of classical time series
Interpretation of the paper: "bert4bitter: a basic model for improving bitter peptide prediction based on transformer (BERT) bidirectional encoder representation"
Smart pointer shared_ PTR and unique_ ptr
Check the sandbox file in the real app
谈谈转动惯量
利用or-tools来求解路径规划问题(TSP)
Interpretation of the paper: iterative feature representation method to improve the prediction performance of N7 methylguanosine (m7G) sites
把LVGL所有控件整合到一个工程中展示(LVGL6.0版本)
NLP natural language processing - Introduction to machine learning and natural language processing (I)
利用pycaret:低代码,自动化机器学习框架解决分类问题
钢结构基本原理全面详细总结
【AUTOSAR CanDrive 1.学习CanDrive的功能和结构】
线性规划之Google OR-Tools 简介与实战
How to establish data analysis thinking
[talent column] can't you use Apache dolphin scheduler? It takes a month to write the most comprehensive introductory teaching [2]