python转exe的问题

python程序打包成exe后遇到的问题

之前一直都是用的家里的电脑用pyinstaller打包的,今天为了方便准备在公司离线的环境下安装pyinstaller的依赖包。
目前在CSDN上找到的两个文件

pyinstaller安装所需文件及其依赖.rar
PyInstaller-3.6-py2.py3-none-any.whl

RAR文件中,Pyinstaller文件无法使用,因此在站内又找了whl文件
安装完成依赖包之后,可以对python进行打包,但exe文件无法使用,以下是操作步骤

首先要说明的是,我的python程序中涉及sys.argv,并且在命令行中运行python程序,可以运行,运行代码和结果如下(为保密我删掉了python程序的路径,将python名称改为test.py,希望不要在意)

D:\>python text.py "D:\xxxx(某文件)" "D:\xxxx(某文件)"
D:\text.py:2: DeprecationWarning: The asyncore module is deprecated and will be removed in Python 3.12. The recommended replacement is asyncio
  from asyncore import write

我先在cmd中输入下命令行,将python转成exe文件:

D:\>pyinstaller -F test.py --exclude-module _bootlocale

输出如下,没有报任何ERROR或者WARNING

34 INFO: PyInstaller: 3.6
34 INFO: Python: 3.10.5
146 INFO: Platform: Windows-10-10.0.17763-SP0
147 INFO: wrote D:\test.spec
150 INFO: UPX is not available.
152 INFO: Extending PYTHONPATH with paths
['D:\\',
 'D:\\']
152 INFO: checking Analysis
152 INFO: Building Analysis because Analysis-00.toc is non existent
152 INFO: Initializing module dependency graph...
153 INFO: Caching module graph hooks...
157 INFO: Analyzing base_library.zip ...
2854 INFO: Processing pre-find module path hook   distutils
2854 INFO: distutils: retargeting to non-venv dir 'C:\\Users\\yuyi\\AppData\\Local\\Programs\\Python\\Python310\\lib'
3481 INFO: Caching module dependency graph...
3597 INFO: running Analysis Analysis-00.toc
3600 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
  required by C:\Users\yuyi\AppData\Local\Programs\Python\Python310\python.exe
3762 INFO: Analyzing D:\test.py
3775 INFO: Processing module hooks...
3775 INFO: Loading module hook "hook-distutils.py"...
3776 INFO: Loading module hook "hook-encodings.py"...
4050 INFO: Loading module hook "hook-lib2to3.py"...
4052 INFO: Loading module hook "hook-pydoc.py"...
4052 INFO: Loading module hook "hook-sysconfig.py"...
4055 INFO: Loading module hook "hook-xml.etree.cElementTree.
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值