gra*_*tii 4 python distutils setuptools pyqt4 python-2.7
因此,我制作了一个小型应用程序,我通常希望将其打包并与世界分享。我阅读了使用 setuptools 打包应用程序的教程。一切进展顺利,直到我被困在一个地方。
我的目录结构是这样的:
- MyApp
- setup.py
- README.md
- LICENSE.txt
- MANIFEST.in
- myapp
- __init__.py
- index.py
- utils
- __init__.py
- helper.py
- some_dump.pickle
- images
- folder_1
- image_1.jpg
- image_2.jpg
- folder_2
- another_image_1.jpg
- another_image_2.jpg
- sounds
- sound_1.wav
- sound_2.wav
Run Code Online (Sandbox Code Playgroud)
setup.py鉴于此目录结构,我使用选项创建了文件作为包含和 的packages列表。我还创建了一个文件,其中包含我想要打包但默认情况下不包含的所有文件。这是清单文件的内容:myappmyapp.utilsMANIFEST.in
include README.md
include LICENSE.txt
include myapp/utils/*.pickle
include myapp/utils/sounds/*.wav
include myapp/utils/images/folder_1/*.jpg
include myapp/utils/images/folder_2/*.jpg
Run Code Online (Sandbox Code Playgroud)
问题是所有这些文件都是按照分发包 (.zip) 中的要求创建的,但是当我尝试使用分发包自己尝试安装包时,我看不到图像、声音或 pickle 文件。即当我运行时python setup.py install,我在文件夹中看不到这些文件build/lib。我不确定原因是什么。有人能帮我解决这个问题吗?
谢谢
清单是关于分发的,而不是关于安装的。您需要指定setup.py要安装的内容和位置:
setup(...,
data_files=[(whereto1, [file1, file2]),
(whereto2, [file3])]
)
Run Code Online (Sandbox Code Playgroud)
请参阅http://docs.python.org/3/distutils/setupscript.html#installing-additional-files
| 归档时间: |
|
| 查看次数: |
767 次 |
| 最近记录: |