¿Cómo instalar scipy y numpy en Ubuntu 16.04?

¿Cómo instalar scipy y numpy en Ubuntu 16.04?

Estoy intentando instalar scipy y numpy en Ubuntu 16.04 pero sigo recibiendo el siguiente error. ¿Alguien puede decirme cómo instalar las dependencias?

Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or 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.

Respuesta1

También puedes usar pip (el instalador de paquetes alternativo de Python) para instalar numpy y scipy para todo el sistema:

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

Esto podría instalarlo independientemente de los errores de dependencia en el administrador de paquetes de Ubuntu.

Respuesta2

Para instalar las dependencias en todas las versiones actualmente compatibles de Ubuntu, abra la terminal y escriba los siguientes comandos:

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

Para Python 3.x

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

Respuesta3

En mi caso, quería instalar scipy en un entorno virtual en lugar de hacerlo globalmente. La instalación de libatlas-base-dev y gfortran antes de la instalación de pip resolvió el problema:

sudo apt-get install libatlas-base-dev
sudo apt-get install gfortran
source .venv/bin/activate
pip install scipy

información relacionada