[求助]入坑学习python 需要装pyinstaller打包成exe
python3吧
全部回复
仅看楼主
level 3
End灬飞虎 楼主
但是 按照百度上给的各种教程 都不成功啊
顺便 版本号是3.6
2017年05月15日 15点05分 1
level 4
设置下面两个python环境变量(要2个哦)
1 C:\Python\Python36-32\Scripts\
2 C:\Python\Python36-32\
下载pyinstaller3.2.1
在cmd,进入pyinstaller文件夹。
python setup.py install 安装pyinstaller
安装成功后
python pyinstaller.py
出现下面的内容就可以了。
usage: pyinstaller.py [-h] [-v] [-D] [-F] [--specpathDIR] [-n NAME] [-p
[--hidden-import MODULENAME]
[--additional-hooks-dir HOOKSPATH]
[--runtime-hook RUNTIME_HOOKS]
[--exclude-module EXCLUDES] [--key KEY][-d] [-s]
[--noupx] [-c] [-w]
[-i <FILE.ico or FILE.exe,ID or FILE.icns>]
[--version-file FILE] [-m <FILE or XML>] [-r RESOUR
[--uac-admin] [--uac-uiaccess]
[--win-private-assemblies] [--win-no-prefer-redirec
[--osx-bundle-identifier BUNDLE_IDENTIFIER]
[--distpath DIR] [--workpath WORKPATH] [-y]
[--upx-dir UPX_DIR] [-a] [--clean] [--log-level LEV
[--upx UPX]
scriptname [scriptname ...]
pyinstaller.py: error: the following arguments arerequired: scriptname
之后
将hello.py(你自己的Python程序)放入pyinstaller所在的文件夹
pyinstaller -F c:\...\hello.py
后面的路径为你的python文件的位置
完后再pyinstaller所在的文件夹里找打包好的文件就行
2017年05月16日 06点05分 4
dalao 你说的那个python36-32 我并没有找到这个路径
2017年05月16日 09点05分
哦对 dalao你所说的cmd出现那一串 我做到了
2017年05月16日 09点05分
就是 dalao你说的 之后 将py程序放入pyinstaller文件夹下 然后的那串代码就是“pyinstaller -F c:”那个 是用cmd打开麽? 还是用IDLE呢?
2017年05月16日 09点05分
dalao?
2017年05月16日 14点05分
level 7
需要从GitHub下载最新的测试版pyinstaller
2017年05月16日 08点05分 5
level 3
End灬飞虎 楼主
防沉补丁 v_1.0
2017年05月16日 14点05分 7
level 4
楼主设置了环境变量么?设置了的话 cmd(控制台) 输入 python -m pip install --upgrade pyinstaller
然后 python -m pip list 或者 python -m pip freeze 看一下你的pyinstaller版本号,
顺带一提,楼主要是去看过pyinstaller文档就该知道下面这句话
Multiversion: supports Python 2.7 and Python 3.3, 3.4 and 3.5.
[滑稽]为了不增加楼主的学习曲线建议楼主改用py3.5呀
顺带一提,楼主不妨去pyinstaller的github那里面看看源码什么的,
2017年05月17日 05点05分 9
那个
2017年05月17日 07点05分
dalao 那个有一个pyinstallerdevelop的压缩包 据说是可以支持3.6的
2017年05月17日 07点05分
还有啊 dalao 再问下 就是 这个要怎麽转exe呢 就是把.py转成exe 很多教程说是用一串代码 那个代码要具体在哪用呢? CMD还是IDLE[滑稽]
2017年05月17日 07点05分
回复 End灬飞虎 :CMD
2017年05月17日 08点05分
level 3
End灬飞虎 楼主
E:\Python>pyinstaller -F E:\Python\123.py
142 INFO: PyInstaller: 3.2.1
142 INFO: Python: 3.5.3
142 INFO: Platform: Windows-7-6.1.7601-SP1
143 INFO: wrote E:\Python\123.spec
144 INFO: UPX is not available.
146 INFO: Extending PYTHONPATH with paths
['E:\\Python', 'E:\\Python']
147 INFO: checking Analysis
147 INFO: Building Analysis because out00-Analysis.toc is non existent
147 INFO: Initializing module dependency graph...
149 INFO: Initializing module graph hooks...
152 INFO: Analyzing base_library.zip ...
3175 INFO: running Analysis out00-Analysis.toc
3179 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of f
inal executable
required by E:\Python\Python\python.exe
3724 INFO: Caching module hooks...
3731 INFO: Analyzing E:\Python\123.py
Traceback (most recent call last):
File "E:\Python\Python\Scripts\pyinstaller-script.py", line 11, in <module>
load_entry_point('PyInstaller==3.2.1', 'console_scripts', 'pyinstaller')()
File "E:\Python\Python\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstall
er\__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "E:\Python\Python\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstall
er\__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "E:\Python\Python\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstall
er\building\build_main.py", line 788, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'
))
File "E:\Python\Python\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstall
er\building\build_main.py", line 734, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "E:\Python\Python\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstall
er\building\build_main.py", line 212, in __init__
self.__postinit__()
File "E:\Python\Python\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstall
er\building\datastruct.py", line 161, in __postinit__
self.assemble()
File "E:\Python\Python\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstall
er\building\build_main.py", line 413, in assemble
priority_scripts.append(self.graph.run_script(script))
File "E:\Python\Python\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstall
er\depend\analysis.py", line 144, in run_script
self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
File "E:\Python\Python\lib\site-packages\pyinstaller-3.2.1-py3.5.egg\PyInstall
er\lib\modulegraph\modulegraph.py", line 1432, in run_script
co_ast = compile(contents, pathname, 'exec', ast.PyCF_ONLY_AST, True)
File "E:\Python\123.py", line 1
Python 3.5.3 (v3.5.3:1880cb95a742, Jan 16 2017, 16:02:32) [MSC v.1900 64 bit
(AMD64)] on win32
^
SyntaxError: invalid syntax
E:\Python>
这是我生成exe时的东西
2017年05月17日 14点05分 11
什麽都看不懂 只知道最后有个ERROR
2017年05月17日 14点05分
@End灬飞虎 [乖]楼主解决了吗,楼主不妨跟着cmd里的这种File "E:\Python\123.py", line 1,line是行数,XXX.PY是文件...一个个跟进去看看...
2017年05月20日 09点05分
@白衣平凡也习惯 呐 那个build dist文件夹都有 build文件夹下有exe.manifest文件 dist是空的 什麽都没有 里面还有一些看不懂的压缩文件?
2017年05月20日 09点05分
@End灬飞虎 [乖]楼主不介意的话把一些详细点的情况贴个图出来看看...比如说打包的程序的内容啥的...还有那个同文件夹下的xxxx.spec spec后缀的文件内容..
2017年05月20日 10点05分
level 1
可爱的楼主啊,能不能分享一下软件呀,我找不到Python3.6,0的64位的,求分享
2017年05月25日 15点05分 12
level 13
现在正式版不支持3.6 退回3.5或者听说github
2017年05月25日 16点05分 13
level 5
3.6现在只有开发版的打包工具 等更新吧
2017年05月26日 00点05分 14
level 1
求问python 3.7版怎么安装pyinstaller库
2018年09月08日 16点09分 15
你好,请问成功安装pyinstaller库了吗?
2018年11月08日 02点11分
@houyuxiao1208 成功了
2018年11月20日 06点11分
level 4
我认识的大神肯定会
2018年11月09日 06点11分 17
level 1
File "c:\program files\python35\lib\site-packages\PyInstaller\depend\analysis.py", line 260, in _safe_import_module
hook_module.pre_safe_import_module(hook_api)
File "c:\program files\python35\lib\site-packages\PyInstaller\hooks\pre_safe_import_module\hook-setuptools.extern.six.moves.py", line 34, in pre_safe_import_module
for real_module_name, six_module_name in real_to_six_module_name.items():
AttributeError: 'str' object has no attribute 'items'
Python3.5.4 打包失败,如何解
2018年11月20日 08点11分 18
level 5
对Python感兴趣的朋友可以加q交流群哦:821189983, 群内每天会更新Python资料和源码,回复:g 即可领取。。还有大神专业指导哦!
2021年02月03日 01点02分 19
1