更新Numpy,Scipy,而不会干扰ubuntu系统的其余部分

时间:2019-09-03 21:54:43

标签: python-3.x numpy scipy ubuntu-16.04

我需要在python3中使用较新版本的Scipy。 我尝试使用以下命令使用pip3进行升级
pip3 install --upgrade scipy --user

Pip3报告说它成功安装了scipy-1.3.1(它还说它跳过了numpy升级)

Collecting scipy
  Using cached https://files.pythonhosted.org/packages/7a/0e/371881e018d...
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in /usr/locallib/python3.5/dist-packages (from scipy) (1.17.0)
Installing collected packages: scipy
Successfully installed scipy-1.3.1

现在,当我导入scipy时,它是旧版本(0.17.0)

>>> print(scipy.__version__)
0.17.0

我尝试重新安装scipy(这次使用sudo) sudo pip3 install --upgrade scipy
但是pip3抱怨它无法卸载较旧的scipy,因为它是distutil软件包。

Collecting scipy
  Downloading https://files.pythonhosted.org/packages/7a/0e/371881e018d...   
    100% |⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜⬜| 25.1MB 895kB/s  
Requirement already satisfied, skipping upgrade: numpy>=1.13.3 in /usr/locallib/python3.5/dist-packages (from scipy) (1.17.0)
Installing collected packages: scipy
  Found existing installation: scipy 0.17.0
Cannot uninstall 'scipy'. It is a distutil installed project and thus we cannot accurately determine which files belong to it whicch would lead to only a partial uninstall.

我尝试使用 synaptic 软件包管理器删除distutil软件包。但是,要卸载 synaptic ,是要我删除其他依赖scipy的软件包。
enter image description here

其中一个软件包 ubuntu-mate-desktop 是我的ubuntu系统的一部分,我不想摆弄它。

请建议我如何在不破坏系统软件包的情况下安装(升级)scipy和numpy。

1 个答案:

答案 0 :(得分:0)

使用虚拟环境virtualenv