python - 尝试为 Python 3 安装 scikit-learn 时出现 "Cannot fetch index base URL"错误消息

标签 python scikit-learn python-3.4

我尝试为 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

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

sudo apt-get install python3-pandas

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

sudo apt-get install python3-sklearn

已添加

当我用 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

根据推荐,我尝试将 pip 与 -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

最佳答案

尝试使用

pip3 install scikit-learn

关于python - 尝试为 Python 3 安装 scikit-learn 时出现 "Cannot fetch index base URL"错误消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38770169/

相关文章:

python - 在 scikit-learn 中实现 K Neighbors Classifier 和 Linear SVM 以进行词义消歧

python - 将 Pandas Dataframe 转换为 sklearn 的 numpy

python - BeautifulSoup 导航忽略指定路径

python - geoJSON:如何创建具有动态数量特征的FeatureCollection?

python - 一个包中的多个模块导入一个公共(public)模块

machine-learning - 将多类模型的类概率转换为 0-100 范围内的分数

python - python2 和 python3 之间的区别 - int() 和 input()

Python 3.4 - 将字符串输入格式化为标题格式

python - 如何从 Python 3 中的当前目录中的文件导入?

python - SQLAlchemy:懒惰 ='raise' 提示字段,即使它们已加载