1. 安裝python新環境(conda create --name 環境名稱 python=版本號):
conda create --name xupeng36 python=3.6
# To activate this environment, use:
# > source activate xupeng36
#
# To deactivate an active environment, use:
# > source deactivate
2. 安裝庫:
2.0)進入鏡像
source activate xupeng36
2.1)添加鏡像
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --set show_channel_urls yes
2.2)開始安裝
conda install numpy
conda install matplotlib
conda install pytorch
conda install Pillow
conda install scipy
conda install scikit-learn
3. 配置jupyter notebook
參考:
https://blog.csdn.net/u011606714/article/details/77741324
https://stackoverflow.com/questions/37085665/in-which-conda-environment-is-jupyter-executing
3.1)安裝
conda install ipykernel
3.2)首先激活對應的conda環境(source activate 環境名稱)
source activate xupeng36
3.3)將環境寫入notebook的kernel中(python -m ipykernel install --user --name 環境名稱 --display-name "Python (環境名稱)")
python -m ipykernel install --user --name xupeng36 --display-name "Python36"
3.4)然後打開notebook
jupyter notebook
3.5)瀏覽器打開對應地址,新建python,就會有對應的環境提示了
ref:
https://www.jianshu.com/p/5e21a225ad83?from=groupmessage
https://blog.csdn.net/lyy14011305/article/details/59500819