[英]Python Distutils Package Distribution
我正在嘗試使用Python 2.7上的distutils
創建一個包安裝程序。
這是我的setup.py
:
from distutils.core import setup
import distutils.command.bdist as bdist
setup_options = {
'name': 'tk',
'version': '1.0',
'description': 'Graphics package that supplements native Tkinter',
'package_dir': {'tk': ''},
# this is because setup.py is in the same directory as the package contents
'packages': ['tk', 'tk.latex'],
}
setup(**setup_options)
使用python setup.py bdist --format=wininst
,然后使用7-Zip查看可執行文件,我找到了這個文件和文件夾目錄:
PURELIB/ # excepted for the executable
tk/ # also expected
latex/ # subpackage, should not be here
some_file_in_tk.py # this should only be located in tk, not in this main directory
在另一台計算機上使用安裝程序時,它會按預期在site-packages
下安裝tk
軟件包。 然而,它也將安裝latex
子包(它是tk
)和所有其他文件tk
。 為什么會這樣,我可以解決這個問題嗎? 謝謝!
文檔中的示例建議使用以下目錄布局:
<root>
├── setup.py
└── tk
├── __init__.py
└── latex
└── __init__.py
其中setup.py
:
from distutils.core import setup
setup(
name='tk',
version='1.0',
description='Graphics package that supplements native Tkinter',
packages=['tk', 'tk.latex'],
)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.