在Centos 8上安装Python 3返回 "Failed to synchronize cache for repo 'BaseOS'"。

问题描述 投票:0回答:1

我使用的是CentOS 8。我正在尝试安装Python 3。命令: : sudo dnf install python3. 错误。

无法同步 "BaseOS "仓库的缓存。

如何解决这个问题?

python linux centos
1个回答
0
投票

Centos对 $releasever 因为他们使用的是完整版 8.0.1905 而不是仅仅 8. 当新版本 8.1.1911 他们将旧版本存档。如果你在安装旧的媒体或使用旧的vagrant盒子,可能会导致以下问题。

[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!

解决这个问题的方法是,在Centos的版本上指定 dnf 命令行中使用 --releasever 这样的选项。

[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.
© www.soinside.com 2019 - 2024. All rights reserved.