【发布时间】:2017-07-11 12:42:49
【问题描述】:
我正在制作一个带有tox 测试和使用fasttext Python 包的项目。 fasttext 使用 cython。我在 tox 环境设置过程中遇到了 cython 错误:ImportError: No module named Cython.Build。
如果我让 tox 使用站点包,我可以让它工作。
我创建了一个产生相同错误消息的小测试:
tox.ini:
[tox]
envlist = py27
[testenv:py27]
# sitepackages=True
commands =
python -m pytest --doctest-modules testinstall.py
deps=
pytest
cython
fasttext
setup.py:
from setuptools import setup
setup(
setup_requires=['cython'],
install_requires=['cython', 'fasttext'],
)
我从 tox 得到的错误是:
Collecting pytest
Using cached pytest-3.0.6-py2.py3-none-any.whl
Collecting cython
Using cached Cython-0.25.2-cp27-cp27mu-manylinux1_x86_64.whl
Collecting fasttext
Using cached fasttext-0.8.3.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/pip-build-8NfmOs/fasttext/setup.py", line 3, in <module>
from Cython.Build import cythonize
ImportError: No module named Cython.Build
我发现pip 的子依赖项的安装顺序存在问题,例如,请参阅https://github.com/h5py/h5py/issues/535,但我认为这个问题已经解决了。
我在 setup_requires with Cython? 看到了一个解决方法,但我看不到我的模块可以使用该解决方法。
这是fasttext 的问题吗?或者我缺少一些设置?
【问题讨论】: