conda安装及jupyter配置

安装及配置

安装基础环境

  • 安装net-tools
yum -y install net-tools
  • 安装development
yum -y groupinstall development
  • 安装wget
  yum install -y wget
  • 安装conda

    • wget https://repo.continuum.io/archive/Miniconda3-latest-Linux-x86_64.sh

    • yum install -y anaconda.x86_64

    • wget https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh

    • chmod +x Anaconda3-5.3.1-Linux-x86_64.sh

      • enter
      • yes
    • vim /root/.bashrc

      • # added by Anaconda3 5.3.1 installer
        # >>> conda init >>>
        # !! Contents within this block are managed by 'conda init' !!
        __conda_setup="$(CONDA_REPORT_ERRORS=false '/root/anaconda3/bin/conda' shell.bash hook 2> /dev/null)"
        if [ $? -eq 0 ]; then
            \eval "$__conda_setup"
        else
            if [ -f "/root/anaconda3/etc/profile.d/conda.sh" ]; then
                . "/root/anaconda3/etc/profile.d/conda.sh"
                CONDA_CHANGEPS1=false conda activate base
            else
                \export PATH="/root/anaconda3/bin:$PATH"
            fi
        fi
        unset __conda_setup
        # <<< conda init <<<
        
        
    • # 将anaconda的bin目录加入PATH,根据版本不同,也可能是~/anaconda3/bin
      echo 'export PATH="~/anaconda3/bin:$PATH"' >> ~/.bashrc
      # 更新bashrc以立即生效
      source ~/.bashrc
      
    • source ~/.bashrc

    • 进入退出环境

      • source activate # 进入conda环境 出现(base)则说明安装成功
        source deactivate # 退出conda环境
        
cd /root/anaconda3/bin
chmod +x activate  deactivate
source activate
  • 配置conda

  • 配置源

配置jupyter

  • jupyter notebook --generate-config

    • jupyter notebook --generate-config
      Writing default config to: /root/.jupyter/jupyter_notebook_config.py
      
  • ipython

    • In [1]: from notebook.auth import passwd
      
      In [2]: passwd()
      Enter password: carr
      Verify password: carr
      Out[2]: 'sha1:5f301c3d31d9:f076bcbe1670b66d8681b031c81a973915d6ae32'
      
      139:sha1:fce4b2b491a2:8eade61399077b38619e3ac98761bd6d26cc2d93
      

开放端口

  • firewall-cmd --add-port=8888/tcp --permanent
  • firewall-cmd --reload
  • firewall-cmd --query-port=8888/tcp

启动

  • jupyter notebook --allow-root

修改主题

pip install jupyterthemes
pip install --upgrade jupyterthemes
jt -l
jt -t oceans16 -f fira -fs 13 -cellw 90% -ofs 11 -dfs 11 -T -T

添加插件

pip install jupyter_contrib_nbextensions
pip install jupyter_nbextensions_configurator 

安装MD文档编辑器

#下载notedown
pip install notedown
#Writing default config to: C:\Users\user\.jupyter\jupyter_notebook_config.py
# 生成配置文档
jupyter notebook --generate-config
修改jupyter_notebook_config.py:
添加c.NotebookApp.contents_manager_class = 'notedown.NotedownContentsManager'

打开设置

  • 在Nbextensions里选择自己需要的配置,以下为个人偏好:
    • Nbextensions edit menu item
    • Python Markdown
    • Code prettify
    • Tree Filter
    • Codefolding
    • ExecuteTime
    • Snippets
    • Table of Contents (2)
    • Variable Inspector
    • Codefolding in Editor
    • Hinterland
    • Jupytext
    • Live Markdown Preview
    • Nbextensions dashboard tab
    • Printview

版权声明:本文为weixin_45405066原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。