Как установить scipy и numpy на Ubuntu 16.04?

Я пытаюсь установить scipy и numpy на Ubuntu 16.04, но продолжаю получать следующую ошибку. Кто-нибудь может сказать мне, как установить зависимости?

Reading package lists... DoneBuilding dependency tree       Reading state information... DoneSome packages could not be installed. This may mean that you haverequested an impossible situation or if you are using the unstabledistribution that some required packages have not yet been createdor been moved out of Incoming.The following information may help to resolve the situation:The following packages have unmet dependencies: python-numpy : Depends: python:any (>= 2.7.5-5~) E: Unable to correct problems, you have held broken packages.

Вы также можете использовать pip (альтернативный установщик пакетов Python) для установки numpy и scipy для всей системы:

sudo apt-get install python-pip  sudo pip install numpy scipy

Это может привести к его установке независимо от ошибок зависимостей в диспетчере пакетов Ubuntu.

Чтобы установить зависимости во всех поддерживаемых в настоящее время версиях Ubuntu, откройте терминал и введите следующие команды:

sudo apt update  sudo apt install --no-install-recommends python2.7-minimal python2.7  sudo apt install python-numpy # in Ubuntu 20.04 and earliersudo apt install python-scipy # in Ubuntu 18.04 and earlier

Для Python 3.x

sudo apt update  sudo apt install --no-install-recommends python3-minimal python3  sudo apt install python3-numpy python3-scipy

В моем случае я хотел, чтобы scipy был установлен в виртуальной среде, а не глобально. Установка libatlas-base-dev и gfortran перед установкой pip решила проблему:

sudo apt-get install libatlas-base-devsudo apt-get install gfortransource .venv/bin/activatepip install scipy

Убедитесь, что ваши источники репо обновлены. Выполните следующую команду, чтобы исправить поврежденные или отсутствующие зависимости. приведенная выше команда sudo apt install -f загрузит отсутствующие зависимости только в том случае, если вы уже установили пакет.