PyPI& pip - 安装包接收错误,读取README.md

时间:2015-12-22 11:43:08

标签: python pip setuptools

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

当在本地运行python setup.py开发时,它运行良好,但在将分发上传到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

1 个答案:

答案 0 :(得分:2)

对此的解决方案是在顶级目录中创建MANIFEST.in,其中包含要包含在分发中的其他文件的行,例如,

include README.md
include LICENSE.txt`

报告工作here。 这也解决了我的发行。

我不确切知道导致这种情况的原因,但可能与更新的PyPI有关,只支持由PyPI described in this PEP直接托管的文件。