当前位置:   article > 正文

把python程序转成.exe_name = co.co_names[oparg]

name = co.co_names[oparg]

Section1  安装

安装 pyInstaller


pip install pyinstaller

---------------------------------------------------------------------

安装过程各种曲折

1.先是直接命令行  pip install pyinstaller,然后命令行网络断开

2.无奈只能本地安装  下载pyinstaller ,解压后到相应目录 python setup.py install


Installed c:\users\superdy\appdata\local\programs\python\python36\lib\site-packages\pyinstaller-3.1.1-py3.6.egg
Processing dependencies for PyInstaller==3.1.1
Searching for pypiwin32
Reading https://pypi.python.org/simple/pypiwin32/
Download error on https://pypi.python.org/simple/pypiwin32/: timed out -- Some packages may not be found!
Couldn't find index page for 'pypiwin32' (maybe misspelled?)
Scanning index of all packages (this may take a while)
Reading https://pypi.python.org/simple/
Download error on https://pypi.python.org/simple/: _ssl.c:733: The handshake operation timed out -- Some packages may not be found!
No local packages or working download links found for pypiwin32
error: Could not find suitable distribution for Requirement.parse('pypiwin32')


这次没有遇到太多阻碍,然后在最后一步,又卡住了


手动下载 pypiwin32 手动安装

然后再次pyinstaller 目录再次 python setup.py install 成功



总结下: 1.如果网络环境可以的话 python setup.py install

2.如果网络环境不行的话,手动下载,手动安装 python setup.py install



Section2   更新和使用

安装完成之后

pyinstaller -F printOne.py


File "C:\Users\superDy\AppData\Local\Programs\Python\Python36\lib\site-packages\pyinstaller-3.1.1-py3.6.egg\PyInstaller\lib\modulegraph\modulegraph.py", line 1499, in _scan_bytecode_stores
    name = co.co_names[oparg]
IndexError: tuple index out of range


猜测是pyinstaller版本不是最新造成的

pip install -U pyinstaller

Successfully installed altgraph-0.14 future-0.16.0 macholib-1.8 pefile-2017.9.3 pyinstaller-3.3 setuptools-36.6.0


继续打包  pyinstaller -F printOne.py


Building EXE from out00-EXE.toc completed successfully.


生成的.exe 默认在dist文件夹下面


完成!

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/盐析白兔/article/detail/199031
推荐阅读
相关标签
  

闽ICP备14008679号