推荐学习书目
› 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 · 3496 views
    This topic created in 3292 days ago, the information mentioned may be changed or developed.

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

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

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