我有一个小python脚本(不带模块(,我想通过pex打包并执行。但是,我在文档中找不到任何选项(https://pex.readthedocs.io/en/latest/buildingpex.html)打包没有入口点的脚本
我正在使用以下命令
pex requests ./app -o app.pex --python-shebang '#!/usr/bin/env python3.9'
您可以将setuptools与PEX一起使用。
流量setup.py
样品:
from setuptools import setup, find_packages
setup(
name='cli',
version='0.1.0',
packages=find_packages(),
include_package_data=True,
install_requires=[
'Click',
],
entry_points={
'console_scripts': [
'cli=pkgname.main:cli',
],
}
)
并在终端中运行:
$ python setup.py bdist_pex --bdist-all
我发现这是不可能的,因此我创建了一个模块和一个主函数。