pip无法解析require.txt中的依赖项

时间:2019-04-20 15:28:53

标签: python pip dependency-management

我的requirments.txt已阅读

Cython
pot

我运行pip install -r requirement.txt

Collecting Cython (from -r requirements.txt (line 30))
  Downloading https://files.pythonhosted.org/packages/e7/bd/59054534d09830394470c14e4dd4a2e8fa64ac14559095a044208bf34c18/Cython-0.29.7-cp35-cp35m-manylinux1_x86_64.whl (2.0MB)
    100% |################################| 2.0MB 17.7MB/s 
Collecting pot (from -r requirements.txt (line 31))
  Downloading https://files.pythonhosted.org/packages/28/4b/7aaa1f840a359f5953dd378e0237fa8faf9b0a415ff7282b7375fbe68d27/POT-0.5.1.tar.gz (720kB)
    100% |################################| 727kB 17.3MB/s 
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-5w30dx4k/pot/setup.py", line 7, in <module>
        from Cython.Build import cythonize
    ImportError: No module named 'Cython'

似乎Cython只是下载而不是安装的,因此pot仍然有安装失败。当我首先手动安装Cython,然后使用pip进行安装时,它可以工作。 有什么解决方案可以自动解决此依赖性吗?

我正在将Ubuntu 18.04与python3配合使用,并且我不想使用conda。

1 个答案:

答案 0 :(得分:0)

也许不是您要找的解决方案,但请尝试使用pipenv。

sudo pip install pipenv
cd /path/to dir # go to project directory
pipenv --python 3.7.3 # python version you wish to use
pipenv install cython
pipenv install numpy # numpy seems to be a dependancy of pot
pipenv install pot

像魅力一样起作用!