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

问题描述 投票:0回答:1

我的requirements.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。

python pip dependency-management
1个回答
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

像魅力一样工作!

© www.soinside.com 2019 - 2024. All rights reserved.