在Centos 8上安装Python 3会返回“无法同步存储库'BaseOS'的缓存”。 [英] Install Python 3 on Centos 8 returns "Failed to synchronize cache for repo 'BaseOS'"

查看:379
本文介绍了在Centos 8上安装Python 3会返回“无法同步存储库'BaseOS'的缓存”。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用CentOS8。我正在尝试安装Python3。命令: sudo dnf install python3 。错误:

I am using CentOS 8. I'm trying to install Python 3. Command: sudo dnf install python3. Error:


无法同步回购'BaseOS'的缓存

Failed to synchronize cache for repo 'BaseOS'

如何解决此问题?

推荐答案

Centos对 $ releasever ,因为他们使用的是完整版本 8.0.1905 ,而不仅仅是 8 。发布新版本 8.1.1911 时,他们将旧版本存档。如果您是在安装旧媒体时使用的,或者使用旧的无用信息盒,则可能会导致以下问题:

Centos did something funny with the value of $releasever in that they were using the full version 8.0.1905 instead of just 8. When the new version 8.1.1911 was released they archived the old version. If you do in install of old media or use an old vagrant box this may cause the following issue:

[vagrant@localhost ~]$ sudo dnf upgrade
CentOS-8.0 - AppStream                                                                                                                                                                                        1.6 kB/s |  38  B     00:00    
CentOS-8.0 - Base                                                                                                                                                                                             748  B/s |  38  B     00:00    
CentOS-8.0 - Extras                                                                                                                                                                                           126  B/s |  38  B     00:00    
Extra Packages for Enterprise Linux Modular 8.0 - x86_64                                                                                                                                                       53 kB/s |  63 kB     00:01    
Extra Packages for Enterprise Linux 8.0 - x86_64                                                                                                                                                               80 kB/s |  63 kB     00:00    
Failed to synchronize cache for repo 'AppStream', ignoring this repo.
Failed to synchronize cache for repo 'BaseOS', ignoring this repo.
Failed to synchronize cache for repo 'extras', ignoring this repo.
Failed to synchronize cache for repo 'epel-modular', ignoring this repo.
Failed to synchronize cache for repo 'epel', ignoring this repo.
Dependencies resolved.
Nothing to do.
Complete!

此问题的解决方法是在 dnf上指定Centos版本命令行,使用-releasever 选项,如下所示:

The fix for this is to specify the Centos version on the dnf command line using the --releasever option like this:

[vagrant@localhost ~]$ sudo dnf upgrade --releasever=8
CentOS-8 - AppStream                                                                                                                                                                                          164 kB/s | 7.0 MB     00:43    
CentOS-8 - Base                                                                                                                                                                                               313 kB/s | 2.2 MB     00:07    
CentOS-8 - Extras                                                                                                                                                                                             5.1 kB/s | 5.5 kB     00:01    
Extra Packages for Enterprise Linux Modular 8 - x86_64                                                                                                                                                         63 kB/s | 116 kB     00:01    
Extra Packages for Enterprise Linux 8 - x86_64                                                                                                                                                                5.9 MB/s | 6.5 MB     00:01    
Dependencies resolved.

这篇关于在Centos 8上安装Python 3会返回“无法同步存储库'BaseOS'的缓存”。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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