低版本python库移植到arm linux问题-requests

一、问题描述

1.当前项目需要在arm linux板子上开发一个基于python的程序

2.板子无网络

3.板子内自带python3.5.2

4.项目需要用到requests库(新版本依赖库使用的语法,低版本python报错)

二、解决步骤

1.安装虚拟环境(在本机中操作,后续将相关库打包移植在arm板内)

conda create -n python35 python=3.5

2.激活虚拟环境

conda activate python35

3.检查虚拟你环境中的python版本

python --version

4.安装依赖库

依赖库内容:

库名 兼容版本 作用
**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">requests</font>** 2.25.1 HTTP 请求库
**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">urllib3</font>** 1.26.x 底层 HTTP 客户端
**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">chardet</font>** 3.0.4 字符编码检测
**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">idna</font>** 2.10 国际化域名处理
**<font style="color:rgb(64, 64, 64);background-color:rgb(236, 236, 236);">certifi</font>** 2020.12.5 SSL 证书验证

pip install "urllib31.26" "chardet3.0.4" "idna2.10" "certifi2020.12.5"

5.安装requests

pip install "requests==2.25.1"

6.验证安装

python -c "import requests; print(requests.version)" # 应输出 2.25.1

三、移植库

1.找到相关虚拟环境位置

一搬在你的anaconda下的envs内,如:C:\software\Anaconda\envs\python35\Lib

2.将库依次移植到arm板上(亦可打总包后一起移植)

3.运行依赖该库程序后,是否报错,依次继续补充库到arm板内
posted @ 2025-05-28 09:27  AubeLiang  阅读(35)  评论(0)    收藏  举报