推荐学习书目
› 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
matsuz
V2EX  ›  Python

请教:我在打包 Python 模块的时候,如何在代码中使用打包进去的静态资源

  •  
  •   matsuz · Nov 19, 2017 · 3459 views
    This topic created in 3257 days ago, the information mentioned may be changed or developed.

    在代码中如何获取到使用 MANIFEST.in 包含进去的静态资源的位置呢?

    6 replies  •  2017-11-20 12:36:53 +08:00
    leavic
        1
    leavic  
       Nov 19, 2017
    能不能去读一遍 pyinstaller 的文档以及 google
    guyskk0x0
        2
    guyskk0x0  
       Nov 19, 2017 via Android
    可以参考下 pypa sampleproject
    pabupa
        3
    pabupa  
       Nov 19, 2017 via Android
    __file__可以拿到当前文件的位置。
    billion
        4
    billion  
       Nov 19, 2017
    你不说你是用的 py2exe 还是 pyinstaller 吗
    jeremaihloo
        5
    jeremaihloo  
       Nov 20, 2017
    还能怎么用,直接用不久可以了吗
    matsuz
        6
    matsuz  
    OP
       Nov 20, 2017 via iPhone
    谢谢各位,我在 StackOverflow 上找到答案了,应该是用 pkg_resources

    我之前可能没表达清楚,我是打包成 python 模块,不是可执行文件。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   5433 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 34ms · UTC 01:25 · PVG 09:25 · LAX 18:25 · JFK 21:25
    ♥ Do have faith in what you're doing.