LoongArch上正常使用`pip install`

原创:你在使用loongarch架构操作系统时,是否遇到pip install 安装失败的情况? 刷到这篇文章,大家可添加评论或者私信我,及时满足大家的需求

那么,下面讲一下如何配置loongarch架构的pip 仓库及开发原理

  1. 如何配置龙芯搭建的python仓库?(LoongArch架构)

官方文档:

http://docs.loongnix.cn/python/python.html

龙芯python官方仓库:

http://pypi.loongnix.cn/

手动配置:

方式一:

loongson@loongson-pc:~$ mkdir -p ~/.pip
loongson@loongson-pc:~$ touch ~/.pip/pip.conf
loongson@loongson-pc:~$ cat ~/.pip/pip.conf
[global]
timeout = 60
index-url = https://pypi.loongnix.cn/loongson/pypi
extra-index-url = https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host = 
    pypi.loongnix.cn
    pypi.tuna.tsinghua.edu.cn

方式二:

loongson@loongson-pc:~$ pip3 install pandas -i https://pypi.loongnix.cn/loongson/pypi --trusted-host pypi.loongnix.cn  --extra-index-url https://pypi.org/simple --trusted-host pypi.org
  1. 龙芯python仓库的整体情况

截至2023.1.30日,龙芯python仓库支持python3.6、3.7、3.8及少量的python2.7、3.9,当前旧世界abi的国产操作系统(龙芯、uos、麒麟)默认带的python版本为3.6、3.7、3.8。

软件包适配优先级,以客户反馈及常用软件包为主

  1. 工作原理

采用的是devpi继承代理的方式进行搭建,会优先下载龙芯python仓库中的wheel包,若龙芯的python仓库中的软件包不是最新版本,会在官网下载(速度可能会慢或者pip install时直接失败)。这时你需要查看龙芯python仓库的版本,指定版本进行安装pip3 install numpy==

(test9) [conda@py-4 python3.8]$ pip3 install numpy==
Looking in indexes: https://pypi.loongnix.cn/loongson/pypi, https://pypi.tuna.tsinghua.edu.cn/simple
ERROR: Could not find a version that satisfies the requirement numpy== (from versions: 1.3.0, 1.4.1, 1.5.0, 1.5.1, 1.6.0, 1.6.1, 1.6.2, 1.7.0, 1.7.1, 1.7.2, 1.8.0, 1.8.1, 1.8.2, 1.9.0, 1.9.1, 1.9.2, 1.9.3, 1.10.0.post2, 1.10.1, 1.10.2, 1.10.4, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.12.0, 1.12.1, 1.13.0, 1.13.1, 1.13.3, 1.14.0, 1.14.1, 1.14.2, 1.14.3, 1.14.4, 1.14.5, 1.14.6, 1.15.0, 1.15.1, 1.15.2, 1.15.3, 1.15.4, 1.16.0, 1.16.1, 1.16.2, 1.16.3, 1.16.4, 1.16.5, 1.16.6, 1.17.0, 1.17.1, 1.17.2, 1.17.3, 1.17.4, 1.17.5, 1.18.0, 1.18.1, 1.18.2, 1.18.3, 1.18.4, 1.18.5, 1.19.0, 1.19.1, 1.19.2, 1.19.3, 1.19.4, 1.19.5, 1.20.0, 1.20.1, 1.20.2, 1.20.3, 1.21.0, 1.21.1, 1.21.2, 1.21.3, 1.21.4, 1.21.5, 1.21.6, 1.22.0, 1.22.1, 1.22.2, 1.22.3, 1.22.4, 1.23.0rc1, 1.23.0rc2, 1.23.0rc3, 1.23.0, 1.23.1, 1.23.2, 1.23.3, 1.23.4, 1.23.5, 1.24.0rc1, 1.24.0rc2, 1.24.0, 1.24.1)
ERROR: No matching distribution found for numpy==
(test9) [conda@py-4 python3.8]$ pip3 install numpy==1.21.1   
Looking in indexes: https://pypi.loongnix.cn/loongson/pypi, https://pypi.tuna.tsinghua.edu.cn/simple
Collecting numpy==1.21.1
  Downloading https://pypi.loongnix.cn/loongson/pypi/%2Bf/0cb/02e6b35c483ad/numpy-1.21.1-cp38-cp38-linux_loongarch64.whl (14.1 MB)
     |████████████████████████████████| 14.1 MB 23.8 MB/s 
Installing collected packages: numpy
Successfully installed numpy-1.21.1
(test9) [conda@py-4 python3.8]$ arch
loongarch64

***若网速较慢,请耐心等待(服务器inside the company)

  1. 知识扩展

pip install 默认安装路径:https://pypi.org/simple

可通过修改配置文件进行修改:/etc/pip.conf 或~/.pip.conf

  • 2
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 3
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值