找不到满足我自己的模块要求的版本

时间:2019-01-06 15:05:18

标签: python pip

我有一个发布到Pip的Python模块,但是我自己安装它很困难,我不确定为什么。

以下是我得到的错误,即使1.0.3确实已发布在注册表中:https://pypi.org/project/Discord-Webhooks/

Could not find a version that satisfies the requirement Discord-Webhooks==1.0.3 (from -r requirements.txt (line 2)) (from versions: )
No matching distribution found for Discord-Webhooks==1.0.3 (from -r requirements.txt (line 2))

这是我的setup.py文件的外观。在构建项目时运行python3 setup.py sdist bdist_wheel不会产生错误。

from setuptools import setup, find_packages

long_description = open('README.md').read()

setup(
  name='Discord Webhooks',
  version='1.0.3',
  py_modules=['discord_webhooks'],
  url='https://github.com/JamesIves/discord-webhooks',
  author='James Ives',
  author_email='email@email.com',
  description='Easy to use package for Python which allows for sending of webhooks to a Discord server.',
  long_description=long_description,
  license='MIT',
  install_requires=[
    'requests==2.21.0'
  ],
  classifiers=[
    'Development Status :: 5 - Production/Stable',
    'Environment :: Other Environment',
    'Intended Audience :: Developers',
    'License :: OSI Approved :: MIT License',
    'Programming Language :: Python :: 3',
    'Programming Language :: Python :: 3.6',
  ],
)

我在这里错过了什么吗?我怎么无法无误运行pip install Discord-Webhooks?我正在运行Python 3.6.0

1 个答案:

答案 0 :(得分:1)

您已经上传了一个使用Python 2构建的轮子,该轮子由轮子名称Discord_Webhooks-1.0.3-py2-none-any.whl中的python标签py2指示。您需要上传使用Python 3构建的轮子:

$ python3 setup.py bdist_wheel

您还可以明确指定标签:

$ python3 setup.py bdist_wheel --python-tag=py3

然后,您还可以使用Python 2构建py3滚轮(当然,如果安装脚本未使用任何不兼容的代码)。如果您的代码同时使用Python 2和3,则另一种可能性是构建通用轮子:

$ python3 setup.py bdist_wheel --universal

这将产生带有python标签py2.py3的转轮,可在两个Python主要版本中安装。

相关问题