2022-04-18Miniconda啟用及配置jupyter環(huán)境

使用輕量級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基本使用
    1. 查看環(huán)境
      conda info -e or conda env list
    2. conda創(chuàng)建,激活,注銷,移除虛擬環(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
  1. 安裝某環(huán)境下的包
conda list
conda install numpy #安裝nunmpy,安裝在默認(rèn)的Python環(huán)境中
conda install -n py27numpy #在Python2編譯環(huán)境中安裝numpy包
  • 創(chuàng)建jupyter
    1. 創(chuàng)建一個獨(dú)立環(huán)境
conda create -n jupyter python=3.7
conda activate jupyter
  1. 在jupyter環(huán)境下使用pip或conda安裝
    安裝jupyter:pip install jupyterorconda install jupyter notebook
  2. jupyter配置
    使用jupyter notebook --generate-config命令生成配置文件jupyter_notebook_config.py,其路徑C:/Users/用戶名/.jupyter/jupyter_notebook_config.py
  3. 安裝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 nbconvert
https://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)

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容