安装scikit-learn的选项 [英] Options for installing scikit-learn

查看:162
本文介绍了安装scikit-learn的选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

来自 http://scikit-learn. org/dev/install.html#building-scikit-learn-with-pip

pip install --user --install-option="--prefix=" -U scikit-learn

-user标志要求pip在$ HOME/.local中安装scikit-learn 因此,该文件夹不需要root权限.该标志应使 pip忽略以前安装在scikit-learn上的任何旧版本 同时受益于numpy和scipy的系统软件包. 要正确地从 来源.

The --user flag asks pip to install scikit-learn in the $HOME/.local folder therefore not requiring root permission. This flag should make pip ignore any old version of scikit-learn previously installed on the system while benefiting from system packages for numpy and scipy. Those dependencies can be long and complex to build correctly from source.

仅当Python具有 带有预定义的prefix =条目的distutils.cfg配置.

The --install-option="--prefix=" flag is only required if Python has a distutils.cfg configuration with a predefined prefix= entry.

  1. 在我的pip 1.5.4man pip中,尽管上面的命令可以运行,为什么没有--user --install-option -U选项?

  1. In man pip for my pip 1.5.4, why are there no --user --install-option -U options, although the above command can run?

对于--install-option

  • 这是什么意思?

  • what does it mean?

如何找出如果Python具有带有预定义的prefix =条目的distutils.cfg配置"?

how shall I find out "if Python has a distutils.cfg configuration with a predefined prefix= entry"?

"distutils.cfg"的作用是什么?

What is "distutils.cfg" used for?

对于-U,这是什么意思?

如果要将scikit-learn安装到系统默认目录中, 我应该运行什么命令?是

If I want to install scikit-learn to my system default directory, what command shall I run? Is it

pip install scikit-learn

?

推荐答案

首先,您一定要升级pip,因为当前版本为6.1.1.运行

First, you should definitely upgrade pip, as the current version is 6.1.1. Run

pip install --upgrade pip

做到这一点.我不一定要相信man pip所说的话,因为对于pip的古老版本来说可能如此.相反,请使用文档此处.

to do that. I wouldn't necessarily trust what man pip has to say, as it may be for an ancient version of pip. Instead, use the docs here.

-U--upgrade是同一件事. --user是分开的.

-U and --upgrade are the same thing. --user is separate.

您不必担心prefixdistutils.cfg.您会知道是否有它们,因为这是您必须手动设置的.因此,只需尝试运行

You don't need to worry about the prefix thing, or distutils.cfg. You'd know if you have them, because it's something you'd have to set up manually. So, just try running

pip install scikit-learn -U --user

升级pip后,希望一切都会顺利进行.

after you've upgraded pip, and hopefully everything will go smoothly.

如果您使用的是Linux或Unix系统(例如OS X),或者您已在Windows上安装了GNU命令行工具,并且希望pip升级您的全部包,此命令应在bash中运行:

If you're on a Linux or Unix system (like OS X), or you have the GNU command-line tools installed on Windows, and you want pip to upgrade all of your packages, this command should work in bash:

pip list | awk '{print $1}' | while read -r package; do sudo -H pip install -U "$package"; done

pip list打印出已安装的每个软件包的名称和版本(至少在我的Ubuntu 14.10系统上,其中包括系统或pip所安装的所有内容)及其括号内的版本号. awk '{print $1}'在空格上分割每一行,并返回第一个字段(程序包名称). while循环读取每个进入的行(程序包名称)并调用sudo -H pip install -U packagename,这将查看该程序包是否是最新的,如果不是最新的,它将对其进行升级.我假设像Ubuntu那样安装的系统软件包不会被升级,因为它们没有在PyPI中列出,但是我在发现之前就杀死了该命令.

pip list prints out the name and version of each package installed (and, at least on my Ubuntu 14.10 system, that includes everything, system- or pip-installed), along with its version number in parentheses. awk '{print $1}' splits each line on whitespace, and returns the first field (the package name). The while loop reads each incoming line (the package name) and calls sudo -H pip install -U packagename, which will look to see if the package is up-to-date, and if not it will upgrade it. I'm assuming system packages like those installed by Ubuntu won't be upgraded, as they're not listed in PyPI, but I killed the command before I found out.

这篇关于安装scikit-learn的选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆