【问题标题】:How do I install packages for python ML on ubuntu?如何在 ubuntu 上为 python ML 安装软件包?
【发布时间】:2018-02-11 07:03:28
【问题描述】:

我在尝试在 Ubuntu 上安装以下软件包时遇到问题:

  • scipy
  • numpy
  • matplotlib
  • 熊猫
  • sklearn

当我执行命令时:
sudo apt-get install python-numpy python-scipy python-matplotlib ipython ipython-notebook python-pandas python-sympy python-nose

我收到以下消息:
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).


所以包安装失败,但是我真的需要这些包来开始一个新项目,我怎样才能成功安装这些包?

【问题讨论】:

  • 避免 Python 安装问题的最好方法是下载 Anaconda。
  • 阅读错误信息!它包含说明。

标签: python numpy ubuntu matplotlib installation


【解决方案1】:

按照建议运行“sudo apt-get -f install”。

您的 apt 存储库似乎已损坏。该命令将修复它。 (-f 用于修复损坏)见http://manpages.ubuntu.com/manpages/xenial/man8/apt-get.8.html

(ps:我删除了我之前的答案,并决定开始一个干净的答案。)

【讨论】:

    【解决方案2】:

    你无法使用 apt-get 安装它。你需要先安装pip。安装 pip 后,谷歌一下如何使用 pip 安装不同的包

    【讨论】:

    • 我尝试安装 pip 本身,但是当我尝试使用:sudo apt-get install python-pip python-dev build-essential 安装它时,我仍然会得到一个像这样的 cmets 列表:Depends: python2.7-dev (>= 2.7.11-1~) but it is not going to be installed
    • 这不是真的。您可以使用apt-get 安装这些软件包,但安装过程可能会很痛苦。
    【解决方案3】:

    试试这个:-

    sudo apt-get install python-pip
    

    要验证下载是否成功,请尝试以下命令。

    pip -V
    

    你应该得到这样的东西:-

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

    之后只需运行以下命令:-

    sudo pip install numpy scipy pandas sklearn matplotlib
    

    这样就可以了。

    【讨论】:

      猜你喜欢
      • 2020-05-31
      • 2017-03-22
      • 2018-08-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-03-11
      相关资源
      最近更新 更多