forked from mindspore-Ecosystem/mindspore
47 lines
1.8 KiB
Bash
47 lines
1.8 KiB
Bash
|
#!/bin/bash
|
||
|
set -ex
|
||
|
|
||
|
MINDSPORE_VERSION=${MINDSPORE_VERSION:-1.5.0}
|
||
|
|
||
|
#use huaweicloud mirror in China
|
||
|
sudo sed -i "s@http://.*archive.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
|
||
|
sudo sed -i "s@http://.*security.ubuntu.com@http://repo.huaweicloud.com@g" /etc/apt/sources.list
|
||
|
sudo apt-get update
|
||
|
|
||
|
# install python 3.7 and make it default
|
||
|
sudo apt-get install gcc-7 libgmp-dev curl python3.7 -y
|
||
|
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 100
|
||
|
|
||
|
cd /tmp
|
||
|
curl -O https://mirrors.tuna.tsinghua.edu.cn/anaconda/miniconda/Miniconda3-py37_4.10.3-Linux-x86_64.sh
|
||
|
bash Miniconda3-py37_4.10.3-Linux-x86_64.sh
|
||
|
|
||
|
# add conda to PATH
|
||
|
echo -e 'export PATH=~/miniconda3/bin/:$PATH' >> ~/.bash_profile
|
||
|
echo -e '. ~/miniconda3/etc/profile.d/conda.sh' >> ~/.bash_profile
|
||
|
source ~/.bash_profile
|
||
|
conda init bash
|
||
|
# setting up conda mirror
|
||
|
cat >~/.condarc <<END
|
||
|
channels:
|
||
|
- defaults
|
||
|
show_channel_urls: true
|
||
|
default_channels:
|
||
|
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
|
||
|
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
|
||
|
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
|
||
|
custom_channels:
|
||
|
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
||
|
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
||
|
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
||
|
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
||
|
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
||
|
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
||
|
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
|
||
|
END
|
||
|
|
||
|
#initialize conda env and install mindspore-cpu
|
||
|
|
||
|
conda create -n py37 python=3.7.5 -y
|
||
|
conda activate py37
|
||
|
conda install mindspore-cpu=${MINDSPORE_VERSION} -c mindspore -c conda-forge -y
|