Anaconda
常用命令
conda create -n name python=3.7 建立新环境conda activate name 进入环境 conda list 查看当前环境安装好的工具conda deactivate 退出环境conda --version 查看conda版本conda info --envs 查看安装了那些环境conda search --full-name python 检查目前有哪些版本的python可以安装conda remove -n name --all 删除环境conda install numpy 安装第三方包conda remove numpy 删除第三方包conda env export > environment.yaml 导出当前环境包信息conda env create -f environment.yaml 创建一个相同的虚拟环境conda list numpy 查看numpy的版本Jupyter 常用指令
常用操作
jupyter kernelspec list 查看安装内核信息Jupyter kernelspec remove tf2 卸载内核jupyter kernelspec uninstall tf2 删除安装多版本Python内核
在Python3 下安装 ipkernel
python -m pip install ipykernel
安装内核到Jupyter
python -m ipykernel install --user --name=python3--user安装到当前用户,可查看帮助选择不同安装位置,也可不加该参数,安装到默认位置。--name为内核命名为py2
查看
jupyter kernelspec list
Pytorch
安装
官网定制 https://pytorch.org/get-started/locally/安装指令: conda install pytorch torchvision torchaudio cudatoolkit=10.2更换镜像源
更换源代码
清华源:
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/msys2/
conda config --set show_channel_urls true
中科大源:
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/msys2/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/bioconda/
conda config --add channels https://mirrors.ustc.edu.cn/anaconda/cloud/menpo/
conda config --set show_channel_urls yes
查看镜像源 - conda config --show-source
Problems
PackagesNotFoundError
终端输入:
conda config --add channels conda-forge
jupyter notebook
在线编写Py程序,优势:可以实时的显示程序运行结果 安装 conda install jupyter notebook