【问题标题】:Specify Python 2.7+ and Python 3.xx (any) in ``setup.py''在“setup.py”中指定 Python 2.7+ 和 Python 3.xx(任意)
【发布时间】:2017-05-29 06:22:24
【问题描述】:

我的“setup.py”目前包含以下语句:

setup(...
    classifiers = [
            ...
            "Programming Language :: Python :: 2.7",
            "Programming Language :: Python :: 3",
            "Programming Language :: Python :: 3.1",
            "Programming Language :: Python :: 3.2",
            "Programming Language :: Python :: 3.3",
            "Programming Language :: Python :: 3.4",
            "Programming Language :: Python :: 3.5",
            "Programming Language :: Python :: 3.6",
            "Programming Language :: Python",
            ...
            ],
    ...
    )

有没有办法让我指定“任何 Python 3,从 3.0 开始”,而不明确列举所有现有和未来的 Python?

我问这个的原因是,即使上面指定了通用的“编程语言 :: Python :: 3”,Anaconda 安装也会失败:

Fetching package metadata ......... 
Solving package specifications: .... 
UnsatisfiableError: The following specifications were found to be in conflict:  
- dendropy 
- python 3.5
* Use "conda info <package>" to see the dependencies for each package

pip 安装工作正常。

谢谢!

【问题讨论】:

  • "Programming Language :: Python :: 3" 有什么问题?
  • 从示例中可以看出,我将其包含在规范中。但是,例如,Anaconda 无法在 Python 3.5 下安装此软件包,而我没有明确包含“Programming Language :: Python :: 3.5”语句。
  • 我不认为pipconda 明确检查特定版本分类器。安装仅包含 "Programming Language :: Python" 说明符的软件包时我没有遇到任何问题。您是否有一个可重现的示例,它何时以及如何不起作用?
  • 如果没有“3.5”规范行,conda 安装将失败并显示vagrant@vagrant-ubuntu-trusty-64:~$ conda install -c ericmjl dendropy Fetching package metadata ......... Solving package specifications: .... UnsatisfiableError: The following specifications were found to be in conflict: - dendropy - python 3.5* Use "conda info &lt;package&gt;" to see the dependencies for each package.
  • 这不依赖于分类器,而是依赖于构建软件包的版本:anaconda.org/ericmjl/dendropy/files(没有 py35 构建可用于 linux)。试试pip install dendropy

标签: python version setup.py


【解决方案1】:

分类器只是提示,conda installpip install 在安装软件包时实际上不会查看它们。 这些提示适用于搜索包裹或查看包裹的人。如果一个包支持所有 python 3 版本,无论你是明确列出它们还是像 "Programming Language :: Python :: 3" 一样列出它们都没有关系,我想大多数访问者都会知道这是什么意思——这更多的是作者的个人喜好问题(以及已经选择的数量)分类器)。

但是,当您使用 conda(即使它是纯 python)安装软件包时,它必须针对您正在使用的 python 和操作系统版本构建。在您的情况下,您尝试从ericmjl conda channel 安装。此频道包含 python 3.5 版本,但仅适用于 OSX,Linux 的二进制文件仅适用于 python 3.4。

您可以使用 pip:pip install dendropy 将其从 PyPI 安装到您的 conda 环境中(确保使用安装在您的 conda 环境中的 pip)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-12-18
    • 1970-01-01
    • 1970-01-01
    • 2016-06-09
    • 2021-10-16
    • 2019-12-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多