简体   繁体   中英

How do I install packages for python ML on ubuntu?

I am having problems trying to install the following packages on Ubuntu:

  • scipy
  • numpy
  • matplotlib
  • pandas
  • sklearn

When I execute the command:
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

I get the following message:
Reading package lists... Done Building dependency tree
Reading state information... Done build-essential is already the newest version (12.1ubuntu2). You might want to run 'apt-get -f install' to correct these: The following packages have unmet dependencies. libatlas-dev : Depends: libblas-dev but it is not going to be installed libatlas3-base : Depends: libgfortran3 (>= 4.6) but it is not going to be installed Depends: libblas-common but it is not going to be installed python-dev : Depends: libpython-dev (= 2.7.11-1) but it is not going to be installed Depends: python2.7-dev (>= 2.7.11-1~) but it is not going to be installed python-scipy : Depends: python-decorator but it is not going to be installed Depends: libgfortran3 (>= 4.6) but it is not going to be installed Recommends: python-imaging but it is not going to be installed python-setuptools : Depends: python-pkg-resources (= 20.7.0-1) but it is not going to be installed rstudio : Depends: libjpeg62 but it is not going to be installed Depends: libgstreamer0.10-0 but it is not going to be installed Depends: libgstreamer-plugins-base0.10-0 but it is not going to be installed Recommends: r-base (>= 2.11.1) but it is not going to be installed E: Unmet dependencies. Try 'apt-get -f install' with no packages (or specify a solution).


So the packages are failing to install, but I really need these packages to begin a new project, how can I successfully install these packages?

Run 'sudo apt-get -f install' as it suggests.

It seems your apt repository is broken. That command will fix it. (-f is for fix-broken) See http://manpages.ubuntu.com/manpages/xenial/man8/apt-get.8.html

(ps: I deleted my earlier answer and decided to start a clean one.)

U cannot install it using apt-get. u need to install pip first. After you install pip, just google about how to install different packages using pip

try this:-

sudo apt-get install python-pip

to verify that that download was successful try the following command.

pip -V

you should get something like this:-

#pip -V
pip 8.1.1 from /usr/lib/python2.7/dist-packages (python 2.7)

after this just run following commands:-

sudo pip install numpy scipy pandas sklearn matplotlib

this will do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM