Skip to main content
python 资源文件快捷打包
===========================


使用场景
-----------------------------


用 Pyinstaller 可以将 Python 程序打包为单个 exe 文件,发送到没有安装 Python 环境的电脑上直接运行,十分方便好用。

可是一旦你的程序中要用到一些资源文件,比如图片、字体等。你发送给对方的文件就不能只是一个 exe 文件了,必须将这些资源文件一起给对方才能正常使用。

这样一来原来的便捷简洁的特点就不复存在了,所以请使用 respack 来帮你解决这一困扰。

原理其实很简单,首先在开发过程中将资源文件的二进制编码以字符串形式保存在一个 .py 文件中。然后程序中调用资源文件时,将上述编码释放为一个实际文件。



使用说明
-----------------------------


```
$ pip install respack

>>> import respack
>>> respack.set('pic.jpg')
>>> # 可以删除 pic.jpg 文件
>>> respack.get('pic.jpg')
C:\packresources\pic.jpg
```


具体见 `demo.py` 中应用示例

Metadata

Release files for respack 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for respack 1.2
File Size Uploaded Provenance
respack-1.2.tar.gz 395.5 kB Without provenance Details

Release files / respack-1.2.tar.gz

Download URL respack-1.2.tar.gz
Size 395.5 kB
Tags Source
SHA-256 checksum
How to use checksums
a8f396567d9b6271f3e8529d629f7460294b5086d69b96037815ef6567477b30
BLAKE2b-256 checksum
How to use checksums
de9f7724a39dc2d36ebc991557f6935f9c56027ea9e49943772b2f34734ea6d6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for respack 1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

1.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page