2016-08-04 107 views
0

我尝试安装scikit学习Python的3。我这样做以下列方式:如何为Python 3安装scikit-learn?

virtualenv model_env 
source model_env/bin/activate 
pip3 install sklearn 

结果我得到了以下错误消息:

Downloading/unpacking sklearn 
    Cannot fetch index base URL https://pypi.python.org/simple/ 
    Could not find any downloads that satisfy the requirement sklearn 
Cleaning up... 
No distributions at all found for sklearn 

我有同样的问题

sudo apt-get install python3-pandas 

不幸的是,同样的方法不适合的工作:与pandas包,我已经使用以下命令解决它sklearn

sudo apt-get install python3-sklearn 

ADDED

当我通过scikit-learn更换sklearn,我有同样的问题:

Downloading/unpacking scikit-learn 
    Cannot fetch index base URL https://pypi.python.org/simple/ 
    Could not find any downloads that satisfy the requirement scikit-learn 
Cleaning up... 
No distributions at all found for scikit-learn 

加入2-

因为它已被推荐,我尝试在combinati中使用点子与-vvv。请注意,我使用pip3而不是pip。这是我得到的结果是:

Downloading/unpacking scikit-learn 
    Getting page https://pypi.python.org/simple/scikit-learn/ 
    Could not fetch URL https://pypi.python.org/simple/scikit-learn/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/scikit-learn/ (Caused by <class 'OSError'>: [Errno 101] Network is unreachable) 
    Will skip URL https://pypi.python.org/simple/scikit-learn/ when looking for download links for scikit-learn 
    Getting page https://pypi.python.org/simple/ 
    Could not fetch URL https://pypi.python.org/simple/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/ (Caused by <class 'OSError'>: [Errno 101] Network is unreachable) 
    Will skip URL https://pypi.python.org/simple/ when looking for download links for scikit-learn 
    Cannot fetch index base URL https://pypi.python.org/simple/ 
    URLs to search for versions for scikit-learn: 
    * https://pypi.python.org/simple/scikit-learn/ 
    Getting page https://pypi.python.org/simple/scikit-learn/ 
    Could not fetch URL https://pypi.python.org/simple/scikit-learn/: connection error: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/scikit-learn/ (Caused by <class 'OSError'>: [Errno 101] Network is unreachable) 
    Will skip URL https://pypi.python.org/simple/scikit-learn/ when looking for download links for scikit-learn 
    Could not find any downloads that satisfy the requirement scikit-learn 
Cleaning up... 
    Removing temporary dir /tmp/pip_build_root... 
No distributions at all found for scikit-learn 
Exception information: 
Traceback (most recent call last): 
    File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 122, in main 
    status = self.run(options, args) 
    File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 278, in run 
    requirement_set.prepare_files(finder, force_root_egg_info=self.bundle, bundle=self.bundle) 
    File "/usr/lib/python3/dist-packages/pip/req.py", line 1178, in prepare_files 
    url = finder.find_requirement(req_to_install, upgrade=self.upgrade) 
    File "/usr/lib/python3/dist-packages/pip/index.py", line 277, in find_requirement 
    raise DistributionNotFound('No distributions at all found for %s' % req) 
pip.exceptions.DistributionNotFound: No distributions at all found for scikit-learn 

Storing debug log for failure in /home/rngorb/.pip/pip.log 
+0

须藤安装PIP画中画-U须藤 PIP安装-U scikit学习 –

+1

包名scikit学习 – Luca

+0

@Luca,'scikit-learn'不工作,以及(见我的问题的更新)。 – Roman

回答

5

使用

pip3 install scikit-learn 
+0

它没有帮助,我仍然有同样的问题(相同的错误信息)。 – Roman

1

也许你应该考虑使用Anaconda它默认包括两个包,使您的生活更轻松的工具来管理enviroments尝试和packages

+0

@Roman我也发现使用Anaconda是安装这些软件包的最简单方法。 [Here](https://eatsleepdata.com/blogs/machine-learning/how-to-install-python-machine-learning-packages-using-anaconda)是使用Anaconda安装scikit-learn的一个例子。 –

0

如果你想要Anaconda包的便利性,但是pip包管理的灵活性和极简主义,我建议你试试miniconda

一旦你安装miniconda(记住要source ~/.bash_profilesource ~/.bashrc),你可以做到这一点,以设置您的环境:

conda create -n myenv scikit-learn pip python=3 

这将让你在情况sklearn和PIP要安装库一个畅达ENV作为conda软件包不支持。点子在conda env内运行。

1

首先更新您的点子:

pip3 install --upgrade pip 

然后安装与ARG “--user” scikit学习。不要使用sudo与PIP因为它会给问题:

pip install --user scikit-learn 
0

,如果你有Python的多个版本,请确保你是在正确站点包路径安装之前。

这是我的情况!