zoukankan      html  css  js  c++  java
  • Jupyter notebook便捷命令集锦

    安装Jupyter

    pip install jupyter
    

    生成jupyter配置文件

    jupyter notebook --generate-config
    

    安装 Jupyter notebook 扩展

    1. 安装nbextensions

      pip install jupyter_contrib_nbextensions -i https://pypi.tuna.tsinghua.edu.cn/simple
      jupyter contrib nbextension install --user
      
    2. 安装nbextensions_configurator

      pip install jupyter_nbextensions_configurator
      jupyter nbextensions_configurator enable --user
      

    使用conda操作虚拟环境:

    1. 创建虚拟环境:conda create -n pytorch python=3.7

    安装ipykernel使得可以在notebook中使用多个 kernel 运行

    在Jupyter notebook 中默认情况下使用的系统默认的python环境,如果需要使用anaconda中的环境配置的话,需要做单独配置。以下是配置方法:

    1. 在默认系统环境中安装 ipykernel,使用xxx虚拟环境

      conda install ipykernel
      conda install -n xxx ipykernel
      
    2. 配置在浏览器界面激活xxx虚拟环境
      这里要注意两点:

      1. 运行该命令时,必须在xxx虚拟环境下
      2. 该环境下必须安装了ipykernel(安装方法:conda install -n xxx ipykernel)
      python -m ipykernel install --user --name xxx --display-name xxx
      

      或者可以通过conda install nb_conda来自动关联conda 环境

    查看kernel列表:jupyter kernelspec list
    删除 xxx kernel:jupyter kernelspec remove xxx

    安装pytorch

    1. 添加/删除Anaconda的TUNA镜像

      添加镜像源

      conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
      

      删除镜像源

      conda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/  # 删除镜像源
      
    2. conda GPU版本的安装命令

      conda install pytorch torchvision -c pytorch
      
    3. conda CPU版本的安装命令

      conda install pytorch-cpu -c pytorch 
      pip3 install torchvision
      

    conda 常用命令:

    1. 在某个特定的虚拟环境下安装包: conda install -n env_name package_name
    2. 激活某个虚拟环境: conda activate env_name
    3. 退出某个虚拟环境: conda deactivate env_name
  • 相关阅读:
    Burp Suite Intruder的4种攻击类型
    JSP Response Set Status
    Mybatis中的#和$的区别
    请求转发、请求重定向
    Spring IoC Container and Spring Bean Example Tutorial
    成员变量声明时初始化和构造方法中初始化的区别
    JDK开发WebService
    Mac设置截图保存位置
    Socket通信
    DOM4J解析xml
  • 原文地址:https://www.cnblogs.com/finlu/p/11611325.html
Copyright © 2011-2022 走看看