栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 软件开发 > 后端开发 > Python

Docker虚拟机no-avx环境安装mxnet-noavx

Python 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Docker虚拟机no-avx环境安装mxnet-noavx

公司生产环境部署,遇到提供的云服务器是no-avx指令集的,导致之前封装打包的容器镜像不可用,启动报错如下内容:

具体原因需要安装mxnet-noavx版本。查询官网库mxnet-noavx · PyPI,安装mxnet-noavx,还需要两个依赖,libopencv-dev 4.2 和libgfortran5。因此首先需要安装这两个依赖。

这边封装的容器系统是Ubuntu,如果直接使用默认源进行安装,libopencv-dev版本大概率不是4.2,而是3.2之类的。安装之前,可以使用来查看源版本是否匹配

apt-cache madison libopencv-dev

结果包含如下内容即可

如果没有,建议使用Ubuntu20.04的阿里云镜像源,更新源,然后安装,步骤如下:

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak
sudo sh -c 'echo "deb http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ focal-backports main restricted universe multiverse
" > /etc/apt/sources.list'
sudo apt update

完成更新源之后,可以再查询一下版本,大概率是可以的。然后执行安装:

apt-get install libopencv-dev libgfortran5

上述完成安装以后,再卸载现有mxnet(如果已卸载或者未安装,则可跳过):

pip uninstall mxnet

再执行安装mxnet-noavx指令:

​pip install mxnet-noavx==2.0.3 -i https://mirror.baidu.com/pypi/simple

如果出现以下错误,说明pip版本过低,需要升级pip再安装:pip install -U pip

安装完成之后,可以进入python,然后import mxnet查看是否能够导入包。

可能会出现python的情况(安装libopencv-dev影响),此时重新配一下软链接。

使用find /usr/bin 'python*'查看自己环境已有python的版本,我的是python3.7,然后使用下面指令新建软链接:

ln -s /usr/bin/python3.7 /usr/bin/python

至此安装mxnet-noavx完成。

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/982194.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号