如何使用setup.py将所有*.py文件添加到包中?
How to add all *.py files to the package with setup.py?
我有一个包含很多 *.py 文件(脚本)和包含 *.py 文件的子目录的目录。
如何将根目录下的所有*.py文件添加到包中?
现在我的setup.py是
from setuptools import setup, find_packages
setup(
name='my-awesome-helloworld-script', # This is the name of your PyPI-package.
version='0.1', # Update the version number for new releases
scripts=['????????????????????'], # The name of your scipt, and also the command you'll be using for calling it
# Packages
packages=find_packages(),
)
如你所见,我已经用find_packages()
解决了文件夹的添加问题。
但是如何从根目录添加*.py文件呢?
我正在用命令打包 python.exe setup.py sdist
。
谢谢!
用代码解决:
from setuptools import setup, find_packages
pckgs=find_packages()
pckgs.append('.')
setup(
name='my-awesome-helloworld-script', # This is the name of your PyPI-package.
version='0.1', # Update the version number for new releases
# scripts=[''], # The name of your scipt, and also the command you'll be using for calling it
# Packages
packages=pckgs,
)
我有一个包含很多 *.py 文件(脚本)和包含 *.py 文件的子目录的目录。
如何将根目录下的所有*.py文件添加到包中?
现在我的setup.py是
from setuptools import setup, find_packages
setup(
name='my-awesome-helloworld-script', # This is the name of your PyPI-package.
version='0.1', # Update the version number for new releases
scripts=['????????????????????'], # The name of your scipt, and also the command you'll be using for calling it
# Packages
packages=find_packages(),
)
如你所见,我已经用find_packages()
解决了文件夹的添加问题。
但是如何从根目录添加*.py文件呢?
我正在用命令打包 python.exe setup.py sdist
。
谢谢!
用代码解决:
from setuptools import setup, find_packages
pckgs=find_packages()
pckgs.append('.')
setup(
name='my-awesome-helloworld-script', # This is the name of your PyPI-package.
version='0.1', # Update the version number for new releases
# scripts=[''], # The name of your scipt, and also the command you'll be using for calling it
# Packages
packages=pckgs,
)