Installing NumPy with pip fails on Ubuntu

前端 未结 5 727
星月不相逢
星月不相逢 2020-12-30 10:50

When I try:

$ sudo pip install numpy

on my Ubuntu 12.04 server, I get:

----------------------------------------------------         


        
相关标签:
5条回答
  • 2020-12-30 11:27

    pip won't install the necessary compilers for you.

    If you simply want numpy, and don't need to go through pip, use

    sudo apt-get install python-numpy
    

    and you'll get all the requisites as well (such as python-dev).

    0 讨论(0)
  • 2020-12-30 11:28

    Incase you do not have access to any internet, then try downloading its dependencies too manually like intel_Openmp, MKL,MKL_include and MKL-devel first and then install numpy

    0 讨论(0)
  • 2020-12-30 11:39

    It seems like your system does not have gcc.

    Install build tools using following command:

    apt-get install build-essential python-dev
    
    0 讨论(0)
  • 2020-12-30 11:39

    Some of these packages may not be required (don't have time to check in detail) but in a setup script of mine to install the NumPy stack I install the following Ubuntu packages first:

    - build-essential
    - gfortran
    - libatlas-base-dev
    - libatlas3gf-base
    - python-dev
    - libjpeg-dev
    - libxml2-dev
    - libfreetype6-dev
    - libpng-dev
    

    Otherwise you could simply use the Anaconda Python distribution, which works great.

    0 讨论(0)
  • 2020-12-30 11:49

    I used to get almost same type of errors but solved it using a virtual environment. There are many environments but I personally suggest venv.

    I was able to easily get rid of the errors using venv.

    It is because loading all libraries on OS using sudo is not appropriate. Your OS becomes big and gives unwanted errors.

    0 讨论(0)
提交回复
热议问题