抱歉,您的浏览器无法访问本站
本页面需要浏览器支持(启用)JavaScript
了解详情 >

ARM源

pip

1
pip install xx -i https://www.piwheels.org/simple

仓库更换(centos举例)

源里面经常会有这种变量:

1
https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/

$basearch 的值,系统硬件架构(CPU指令集)

架构是aarch64(ARM)

$stream 的值,就是系统版本了

版本是CentOS Stream release 9

地址代入该系统变量后的路径就是

1
https://mirrors.aliyun.com/centos-stream/9-stream/AppStream/aarch64/os/

更换源

备份

1
sudo mv /etc/yum.repos.d/centos.repo /etc/yum.repos.d/centos.repo.backup

换成阿里源

1
sudo vi /etc/yum.repos.d/centos.repo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - mirrors.aliyun.com
#failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/BaseOS/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/BaseOS/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/BaseOS/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

#additional packages that may be useful
#[extras]
#name=CentOS-$releasever - Extras - mirrors.aliyun.com
#failovermethod=priority
#baseurl=https://mirrors.aliyun.com/centos-stream/$stream/extras/$basearch/os/
# http://mirrors.aliyuncs.com/centos-stream/$stream/extras/$basearch/os/
# http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/extras/$basearch/os/
#gpgcheck=1
#gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - mirrors.aliyun.com
#failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/centosplus/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/centosplus/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/centosplus/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official

[PowerTools]
name=CentOS-$releasever - PowerTools - mirrors.aliyun.com
failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/PowerTools/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/PowerTools/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/PowerTools/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official


[AppStream]
name=CentOS-$releasever - AppStream - mirrors.aliyun.com
#failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/AppStream/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/AppStream/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/AppStream/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
1
2
3
yum clean all
yum makecache
sudo yum update

如果想使用dnf的话,使dnf的源也更新

1
sudo dnf makecache


添加CRB仓库

1
vim /etc/yum.repos.d/centos.repo

最后一行加入

1
2
3
4
5
6
7
8
[crb]
name = =CentOS-$releasever - CRB - mirrors.aliyun.com
#failovermethod=priority
baseurl=https://mirrors.aliyun.com/centos-stream/$stream/CRB/$basearch/os/
http://mirrors.aliyuncs.com/centos-stream/$stream/CRB/$basearch/os/
http://mirrors.cloud.aliyuncs.com/centos-stream/$stream/CRB/$basearch/os/
gpgcheck=1
gpgkey=https://mirrors.aliyun.com/centos/RPM-GPG-KEY-CentOS-Official
1
2
dnf makecache
yum makecache

用crb下载

1
dnf --enablerepo=crb install <包名> -y

ubuntu安装包时判断仓库、架构

可以通过https://pkgs.org/来查看要下载的包,是属于哪个仓库源的

比如:

1
dnf install libnetfilter_queue-devel

报错找不到这个包:libnetfilter_queue-devel

在官网查询,找到自己对应的系统版本。可以看到显示这个包是arrch64架构的。

点进去查看详细信息。这里显示了它的仓库是CRB的,所以需要切换仓库下载

1
dnf --enablerepo=crb install libnetfilter_queue-devel -y

pip包判断

pip版本为python2.7的

1
pip install httplib2

报错

1
2
3
4
5
6
7
8
9
10
 ERROR: Command errored out with exit status 1:
command: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp0SlrZb
cwd: /tmp/pip-install-p9wQcj/httplib2
Complete output (4 lines):
Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py", line 16, in <module>
from importlib import import_module
ImportError: No module named importlib
----------------------------------------
ERROR: Command errored out with exit status 1: /usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517/_in_process.py get_requires_for_build_wheel /tmp/tmp0SlrZb Check the logs for full command output.

这时候不要去看 No module named importlib

而是去看报错路径usr/bin/python2 /usr/local/lib/python2.7/dist-packages/pip/_vendor/pep517

实际上可以发现,arm的版本下,没有这条路径。

所以想到应该把pip的源更换为arm的源

1
https://www.piwheels.org/simple
1
pip install xx -i https://www.piwheels.org/simple

但是安装失败,去查询官网,可以发现

这个包只支持python3.不支持python2.

评论