推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
seventhbible
V2EX  ›  Python

请问在将自己的 Python 工程输出 EXE 文件时,如何将 xml 等文件一起打包进去。

  •  
  •   seventhbible · Feb 19, 2021 · 2655 views
    This topic created in 1915 days ago, the information mentioned may be changed or developed.
    我的 py 文件中使用到了 xml 文件作为每次的数据存储体,但是在使用 pyinstaller 打包成 exe 的时候,生成的 exe 在执行过程中会报错并闪退。主要是说好像找不到 xml 文件。我的 xml 文件都放在 ide 工程文件中一个名叫 xml 的文件夹下。
    请问我该如何做才可以使得打包的 exe 可以带上这些 xml 文件?
    5 replies    2021-02-20 18:35:12 +08:00
    LeeReamond
        3
    LeeReamond  
       Feb 19, 2021
    问下 lz pyinstaller 使用体验怎么样,我自己用它打包之后程序启动特别缓慢,有时甚至要十多秒,感觉是完全无法接受的使用体验
    seventhbible
        4
    seventhbible  
    OP
       Feb 20, 2021
    感谢 lz 大大们的回复,研究了一段时间搞定了。。。

    @LeeReamond pyinstaller 打包的时候,你可以--onefile 选项打包成一个单独的 exe,这个 exe 在 win 下启动的时候会有点慢,大概等 5-7 秒。但是如果你打包成一个包含了很多内部 py 文件的文件夹,那么就会启动非常快。
    LeeReamond
        5
    LeeReamond  
       Feb 20, 2021
    @seventhbible 受教了
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2979 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 53ms · UTC 14:30 · PVG 22:30 · LAX 07:30 · JFK 10:30
    ♥ Do have faith in what you're doing.