MindSpore Nightly是包含当前最新功能与bugfix的预览版本,但是可能未经完整的测试与验证,希望体验最新功能或者问题修复的用户可以使用该版本。
本文档介绍如何在CPU环境的Linux系统上,使用pip方式快速安装MindSpore Nightly。
在确认系统环境信息的过程中,如需了解如何安装第三方依赖软件,可以参考社区提供的实践——在Ubuntu(CPU)上进行源码编译安装MindSpore中的第三方依赖软件安装相关部分,在此感谢社区成员damon0626的分享。
下表列出了安装MindSpore所需的系统环境和第三方依赖。
软件名称 | 版本 | 作用 |
---|---|---|
Ubuntu | 18.04 | 运行MindSpore的操作系统 |
Python | 3.7-3.9 | MindSpore的使用依赖Python环境 |
GCC | 7.3.0到9.4.0之间 | 用于编译MindSpore的C++编译器 |
下面给出第三方依赖的安装方法。
Python可通过多种方式进行安装。
通过Conda安装Python
安装Miniconda:
cd /tmp
curl -O https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py37_4.10.3-Linux-$(arch).sh
bash Miniconda3-py37_4.10.3-Linux-$(arch).sh -b
cd -
. ~/miniconda3/etc/profile.d/conda.sh
conda init bash
安装完成后,可以为Conda设置清华源加速下载,参考此处。
创建虚拟环境,以Python 3.7.5为例:
conda create -n mindspore_py37 python=3.7.5 -y
conda activate mindspore_py37
通过APT安装Python,命令如下。
sudo apt-get update
sudo apt-get install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa -y
sudo apt-get install python3.7 python3.7-dev python3.7-distutils python3-pip -y
# 将新安装的Python设为默认
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 100
# 安装pip
python -m pip install pip -i https://repo.huaweicloud.com/repository/pypi/simple
sudo update-alternatives --install /usr/bin/pip pip ~/.local/bin/pip3.7 100
pip config set global.index-url https://repo.huaweicloud.com/repository/pypi/simple
若要安装其他Python版本,只需更改命令中的3.7
。
可以通过以下命令查看Python版本。
python --version
可以通过以下命令安装GCC。
sudo apt-get install gcc -y
执行如下命令安装MindSpore:
pip install mindspore-dev -i https://pypi.tuna.tsinghua.edu.cn/simple
其中:
python -c "import mindspore;mindspore.run_check()"
如果输出:
MindSpore version: 版本号
The result of multiplication calculation is correct, MindSpore has been installed successfully!
说明MindSpore安装成功了。
当需要升级MindSpore版本时,可执行如下命令:
pip install --upgrade mindspore-dev=={version}
其中:
{version}
为rc版本号,例如1.6.0rc1.dev20211125;如果希望自动升级到最新版本,=={version}
字段可以缺省。Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》