gpt4 book ai didi

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

转载 作者:太空宇宙 更新时间:2023-11-04 06:50:02 24 4
gpt4 key购买 nike

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

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com