在“setup.py"中指定 Python 2.7+ 和 Python 3.xx(任何) [英] Specify Python 2.7+ and Python 3.xx (any) in ``setup.py''

查看:39
本文介绍了在“setup.py"中指定 Python 2.7+ 和 Python 3.xx(任何)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

My "setup.py" currently includes the following statement:

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?

Is there a way for me to specify "any Python 3, from 3.0 upwards", without explicitly enumerating all the existing and future Pythons?

我问这个的原因是,即使上面指定了一般的编程语言 :: Python :: 3",Anaconda 安装失败:

The reason I ask this is because, even though the general "Programming Language :: Python :: 3" is specified in the above, an Anaconda install fails with:

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 安装工作正常.

谢谢!

推荐答案

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

The classifiers are just hints, neither conda install or pip install actually looks at them when you install a package. These hints are for the people searching for a package or looking at a package. If a package supports all python 3 versions it doesn't matter if you list them explicitly or just as "Programming Language :: Python :: 3" I guess most visitors will know what's meant - it's more a matter of personal preference of the author (and the number of already chosen classifiers).

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

However when you install the package with conda (even if it's pure python) it has to built against the python and OS version you're using. In your case you try to install from the ericmjl conda channel. This channel contains the python 3.5 version but only for OSX, the binaries for linux are python 3.4 only.

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

You could install it from PyPI into your conda environment by using pip: pip install dendropy (make sure you use the pip that's installed in your conda environment).

这篇关于在“setup.py"中指定 Python 2.7+ 和 Python 3.xx(任何)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆