首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >“无法获取索引基URL”错误消息时,试图安装scikit-学习Python 3

“无法获取索引基URL”错误消息时,试图安装scikit-学习Python 3
EN

Stack Overflow用户
提问于 2016-08-04 14:26:32
回答 7查看 23.9K关注 0票数 1

我试着安装scikit-学习Python 3。我这样做的方式如下:

代码语言:javascript
复制
virtualenv model_env
source  model_env/bin/activate
pip3 install sklearn

因此,我得到以下错误消息:

代码语言:javascript
复制
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

我在pandas包中遇到了同样的问题,我使用以下命令解决了这个问题:

代码语言:javascript
复制
sudo apt-get install python3-pandas

不幸的是,同样的方法不适用于sklearn

代码语言:javascript
复制
sudo apt-get install python3-sklearn

添加了

当我用sklearn替换scikit-learn时,我也遇到了同样的问题:

代码语言:javascript
复制
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

正如建议的那样,我尝试将pip与-vvv结合使用。请注意,我使用的是pip3而不是pip。这就是我得到的结果:

代码语言:javascript
复制
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
EN

回答 7

Stack Overflow用户

发布于 2016-08-04 14:29:41

试着使用

代码语言:javascript
复制
pip3 install scikit-learn
票数 9
EN

Stack Overflow用户

发布于 2017-08-03 23:01:46

首先更新您的pip:

代码语言:javascript
复制
pip3 install --upgrade pip

然后安装scikit-学习arg“--用户”。不要和pip一起使用sudo,因为它会产生问题:

代码语言:javascript
复制
pip install --user scikit-learn
票数 2
EN

Stack Overflow用户

发布于 2016-08-04 14:46:25

也许您应该考虑使用蟒蛇 (默认情况下包括两个包),并使用管理环境套餐的工具简化您的生活。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/38770169

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档