我按照this教程将我自己的包添加到.pex中,但此教程基于python 2,我尝试为python3.10.6重新创建,但不起作用。我的包的结构如下hello/init.py,hello/hello.py,hello/setup.py
初始化.py(空)
hello.py:
def hello():
print("hello!")
setup.py:
from distutils.core import setup
setup( name='hello', version='0.0.1', py_modules=['hello'] )
但当我尝试构建pex文件时,显示以下错误:
$ pex hello -e hello:hello -o hello.pex
pid 282 -> /home/leraes93/.pex/venvs/607954d150b1247ce7c1a15f91d4c7d23be98298/5985ed09b49a653d6596b0e14d134c5456cf1a9f/bin/python -sE /home/leraes93/.pex/venvs/607954d150b1247ce7c1a15f91d4c7d23be98298/5985ed09b49a653d6596b0e14d134c5456cf1a9f/pex --disable-pip-version-check --no-python-version-warning --exists-action a --no-input --use-deprecated legacy-resolver --isolated -q --cache-dir /home/leraes93/.pex/pip_cache download --dest /home/leraes93/.pex/downloads/resolver_download.dbt8psp4/mnt.c.Users.PC.Documents.env_medical_app.bin.python3 hello --index-url https://pypi.org/simple
--retries 5 --timeout 15 exited with 1 and STDERR:
Re-execing from /home/leraes93/.pex/venvs/607954d150b1247ce7c1a15f91d4c7d23be98298/5985ed09b49a653d6596b0e14d134c5456cf1a9f/bin/python
ERROR: Could not find a version that satisfies the requirement hello (from versions: none)
ERROR: No matching distribution found for hello
1条答案
按热度按时间5ktev3wc1#
对于运行,只需运行以下命令:'./应用程序. pex'
文件夹列表:从安装程序导入操作系统工具导入安装程序,查找软件包APP版本= os. environ. get("APP版本",'0.0.0')APP名称= os. environ. get("APP名称",'api名称")setup.py ----- `import os from setuptools import setup, find_packages APP_VERSION = os.environ.get("APP_VERSION", '0.0.0') APP_NAME = os.environ.get("APP_NAME", "api-name")
setup.cfg-----[pycodestyle]最大行长度= 200忽略= W605、E402、E713、E712