gpt4 book ai didi

python - PyPI 和 pip - 安装的包在读取 README.md 时收到错误

转载 作者:行者123 更新时间:2023-11-30 23:02:37 24 4
gpt4 key购买 nike

我正在尝试安装上传到 PyPI 的包,但由于某种原因,我总是收到有关未找到 README.md 的错误。

在本地运行 python setup.pydevelopment 时效果很好,但是将发行版上传到 PyPI 后,我收到了附加的错误:

这是我的 setup.py 文件:

from setuptools import setup, find_packages
import os

name = "AWS-Manager"
version = '0.2a'
description = "An open source project for managing your AWS resources easily in your day to day coding"
long_description = "README.md"
author = 'Asaf Nevo, Aviv Paz',
author_email = 'asafnevo1@gmail.com, avivpaz43556@gmail.com'
license_type = "GNU"
keywords = 'aws ec2 amazon servers vpc awscli'


def read(file_name):
"""
Read a text file in the Root directory
:param str file_name: the name of the file
:return: the content of the text file
:rtype: str
"""
return open(os.path.join(os.path.dirname(os.path.realpath(__file__)), file_name)).read()


setup(
author=author,
author_email=author_email,
name=name,
version=version,
license=license_type,
description=description,
long_description=read(long_description),
packages=find_packages(exclude=['ez_setup', 'examples', 'tests']),
install_requires=["boto3"],
entry_points={
'console_scripts': [
'awsmanager = aws_manager.main:main',
],
},
keywords=keywords,
zip_safe=False,
include_package_data=True
)

running sudo -H pip install AWS-Manager时出现错误

Collecting AWS-Manager
Downloading AWS-Manager-0.2a0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 20, in <module>
File "/private/tmp/pip-build-9nio8w/AWS-Manager/setup.py", line 31, in <module>
long_description=read(long_description),
File "/private/tmp/pip-build-9nio8w/AWS-Manager/setup.py", line 21, in read
return open(os.path.join(os.path.dirname(os.path.realpath(__file__)), file_name)).read()
IOError: [Errno 2] No such file or directory: '/private/tmp/pip-build-9nio8w/AWS-Manager/README.md'

----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-9nio8w/AWS-Manager

最佳答案

解决此问题的方法是在顶级目录中创建一个 MANIFEST.in,其中包含要包含在发行版中的其他文件的行,例如,

include README.md
include LICENSE.txt`

据报道工作here 。这也解决了我的发行版的问题。

我不知道到底是什么原因造成的,但它可能与 PyPI 更新为仅支持由 PyPI described in this PEP 直接托管的文件有关。 .

关于python - PyPI 和 pip - 安装的包在读取 README.md 时收到错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34415182/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com