使用輕量級Anaconda--Miniconda
步驟:
- 下載源:清華鏡像站
- 安裝:全程下一步就完了
- 檢驗(yàn)安裝:
cmd---> conda(出現(xiàn)conda信息)或conda -V - 配置:
更換國內(nèi)源:在Anaconda Prompt(Miniconda3) 中使用conda config --set show_channel_urls yes生成.condarc文件
其路徑:C:\Users\用戶名\.condarc
.condarc文件內(nèi)容:
鏡像站給出:
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
- conda基本使用
- 查看環(huán)境
conda info -eorconda env list - conda創(chuàng)建,激活,注銷,移除虛擬環(huán)境
- 查看環(huán)境
#(1)創(chuàng)建虛擬環(huán)境,同時指定python版本
conda create -n jupyter python=3.5
#(2)激活環(huán)境
conda activate jupyter
#(3) 注銷or退出當(dāng)前環(huán)境
conda deactivate jupyter
# (4)移除環(huán)境
conda remove -n jupyter--all
- 安裝某環(huán)境下的包
conda list
conda install numpy #安裝nunmpy,安裝在默認(rèn)的Python環(huán)境中
conda install -n py27numpy #在Python2編譯環(huán)境中安裝numpy包
- 創(chuàng)建jupyter
- 創(chuàng)建一個獨(dú)立環(huán)境
conda create -n jupyter python=3.7
conda activate jupyter
- 在jupyter環(huán)境下使用pip或conda安裝
安裝jupyter:pip install jupyterorconda install jupyter notebook - jupyter配置
使用jupyter notebook --generate-config命令生成配置文件jupyter_notebook_config.py,其路徑C:/Users/用戶名/.jupyter/jupyter_notebook_config.py - 安裝jupyter插件
# step1: jupyter_contrib_nbextensions
# 用 pip 安裝,二選一
# pip install jupyter_contrib_nbextensions
# 或用 conda 安裝,二選一
conda install -c conda-forge jupyter_contrib_nbextensions
# 設(shè)置用戶
# jupyter contrib nbextension install --user
step2: jupyter_nbextensions_configurator
# 用 pip 安裝,二選一
# pip install jupyter_nbextensions_configurator
# 或用 conda 安裝 ,二選一
conda install -c conda-forge jupyter_nbextensions_configurator
# 設(shè)置用戶
jupyter contrib nbextension install --user
# 啟用用戶
jupyter nbextensions_configurator enable --user
出現(xiàn)問題:安裝無法打開.ipynb文件,出現(xiàn)500

image.png
報(bào)錯是因?yàn)閚bconvert 和pandoc不兼容導(dǎo)致
解決辦法:輸入如下命令,安裝升級nbconvert
pip install --upgrade --user nbconverthttps://blog.csdn.net/weixin_49779629/article/details/124064674
將conda中的環(huán)境添加到j(luò)upyter
python -m ipykernel install --user --name=環(huán)境名 --display-name "Python (環(huán)境名)"(需ipykernel)
