【问题标题】:Update Numpy, Scipy without disturbing the rest of ubuntu system更新 Numpy、Scipy 而不会干扰 ubuntu 系统的其余部分
【发布时间】:2019-09-03 21:54:43
【问题描述】:

我需要在 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 的软件包。

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

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

【问题讨论】:

  • 不要将系统 Python 用于这些事情!
  • 切勿发布代码、错误或输出的图像!
  • 请勿发布代码、数据、错误消息等的图片。 - 复制或键入问题中的文本。 stackoverflow.com/help/how-to-ask 通常我会在我的 cmets 中包含该链接。我不知道为什么我以前没有。

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


【解决方案1】:

使用虚拟环境virtualenv

【讨论】:

  • 这是一个很好的解决方法。原来的问题有解决办法吗?
  • 这是推荐的解决方案(使用 virtualenv 或 venv 取模),而不是解决方法。
  • 我过去使用过虚拟环境,这是一种开销。我想要一套包裹。这样我就不必做venv activate 以及在哪个环境中包含哪些软件包等。感谢您的回答,但这不是我想要的。
猜你喜欢
  • 1970-01-01
  • 2015-05-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-13
  • 1970-01-01
  • 2012-03-28
  • 1970-01-01
相关资源
最近更新 更多