首页 > 解决方案 > 安装numpy时的循环依赖

问题描述

我正在尝试在我的 virtualenv 中安装 numpy,但我面临如下循环依赖:

(test) [hadoop@ip-192-168-26-8 test]$ python -m pip install numpy
Collecting numpy
  Using cached https://files.pythonhosted.org/packages/62/20/4d43e141b5bc426ba38274933ef8e76e85c7adea2c321ecf9ebf7421cedf/numpy-1.18.1-cp36-cp36m-manylinux1_x86_64.whl
ERROR: tensorboard 2.1.0 requires grpcio>=1.24.3, which is not installed.
ERROR: tensorboard 2.1.0 requires markdown>=2.6.8, which is not installed.
ERROR: tensorboard 2.1.0 requires protobuf>=3.6.0, which is not installed.
ERROR: tensorboard 2.1.0 requires werkzeug>=0.11.15, which is not installed.
Installing collected packages: numpy
Successfully installed numpy-1.18.1

然后当我尝试安装 grpcio

(test) [hadoop@ip-192-168-26-8 test]$ python -m pip install grpcio
Collecting grpcio
  Using cached https://files.pythonhosted.org/packages/17/8f/f79c5c174bebece41f824dd7b1ba98da45dc2d4c373b38ac6a7f6a5acb5e/grpcio-1.26.0-cp36-cp36m-manylinux2010_x86_64.whl
Requirement already satisfied: six>=1.5.2 in ./lib/python3.6/dist-packages (from grpcio) (1.14.0)
ERROR: tensorboard 2.1.0 requires markdown>=2.6.8, which is not installed.
ERROR: tensorboard 2.1.0 requires numpy>=1.12.0, which is not installed.
ERROR: tensorboard 2.1.0 requires protobuf>=3.6.0, which is not installed.
ERROR: tensorboard 2.1.0 requires werkzeug>=0.11.15, which is not installed.
Installing collected packages: grpcio
Successfully installed grpcio-1.26.0

我什至不确定为什么它给了我不正确的提示Successfully installed grpcio-1.26.0,因为当我使用 list 命令时它们没有被添加到我的 pip 中。

标签: pythonnumpyvirtualenv

解决方案


您介意使用以下命令卸载 numpy:

pip uninstall numpy

并使用 --no-cache-dir 选项再次安装它:

pip install numpy --no-cache-dir

另外,请参阅 pip 已升级。


推荐阅读