简体   繁体   English

Pypi 和 Cython

[英]Pypi and Cython

I'm trying to put together my first PyPi package and am growing confused about some basic aspects of it.我正在尝试将我的第一个 PyPi 包放在一起,但对它的一些基本方面越来越感到困惑。

My package depends on SNPknock .我的包依赖于SNPknock When I try to install it on a fresh system (Ubuntu 18.04), I get:当我尝试在新系统(Ubuntu 18.04)上安装它时,我得到:

pip install snpknock
Collecting snpknock
  Using cached https://files.pythonhosted.org/packages/68/a0/ceb6adc2b7f1a3009f2077c157a99640094021a66f881cb678ecf4
78887f/SNPknock-0.5.2.tar.gz
    Complete output from command python setup.py egg_info:
    You don't seem to have Cython installed. Please get a
    copy from www.cython.org and install it

I've extracted the setup.py from the tarball here , which includes that error message.我已经从这里的 tarball 中提取了setup.py ,其中包含该错误消息。

Here is my confusion.这是我的困惑。 The setup.py file specifies Cython as a dependency: setup.py文件指定 Cython 作为依赖项:

DEPENDENCIES = ['Cython>='+CYTHON_MIN_VERSION,
                'numpy>='+NUMPY_MIN_VERSION]

However, it also imports Cython, but it seems that it needs to do that in order to cythonize some modules.但是,它也导入了 Cython,但似乎需要这样做才能对某些模块进行 cythonize。 It all seems a little circular, but I suspect that either I (or the author of this package) are missing something about this process.这一切似乎有点循环,但我怀疑我(或此包的作者)缺少有关此过程的某些信息。

The problem seems to be there are no wheels/eggs for you platform.问题似乎是您的平台没有轮子/鸡蛋。 In that case pip downloads sources and runs python setup.py install .在这种情况下pip下载源并运行python setup.py install If setup.py imports Cython it doesn't matter if said Cython is listed as a dependency.如果setup.py导入Cython ,则所述Cython是否被列为依赖项并不重要。 You must have Cython before running pip install because pip cannot get a list of dependencies from source code without running setup.py and setup.py requires Cython to be importable.您必须在运行pip install之前pip install Cython ,因为pip无法在不运行setup.py情况下从源代码获取依赖项列表,并且setup.py要求Cython可导入。

If snpknock were ever release an egg or a wheel for your Python version pip would download it, get a list of dependencies and install them without consulting setup.py ;如果snpknock曾经为您的 Python 版本发布过一个蛋或一个轮子, pip会下载它,获取依赖项列表并安装它们,而无需咨询setup.py after that it'd install the package.之后它会安装软件包。 In that case pip would automatically download Cython or install compiled extensions right from the egg/wheel.在这种情况下, pip会自动下载Cython或直接从 egg/wheel 安装已编译的扩展。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM