官网或者镜像网站下载安装包
Anaconda3-5.1.0-Windows-x86_64
安装路径不要选择c盘:
因为这样使用pip/conda install/uninstall会出现IO错误,也就是读写错误
在win10中
因为使用conda中的pip等命令时,需要读写文件,c盘受保护,所以权限不够
所以windows需要安装在d盘
安装:
安装过程中不要选择配置环境变量:安装后自己添加
安装过程中跳过visual studio code安装:因为太慢,以后想安装可以在anaconda navigator中install
介绍一下visual studio code:是微软开发的一款可视化(GUI)代码编写软件,不是IDE(集成开发环境)
配置环境变量:
目的就是为了在cmd中能够运行conda的一些exe文件,也就是conda,python,pip等命令
如果不想配置,直接在anaconda prompt中可以使用相关命令
添加清华源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes
更换了源就是快很多啊
安装tensorflow包:
pip/conda install tensorflow
有的包只能使用pip install不能用conda install
使用conda创建虚拟开发环境:
conda create -n test_conda1 python=3.6
conda create -n test_conda2 python=2.7
激活:activate test_conda
反激活:deactivate
使用jupyter notebook:
键入jupyter notebook即可
如果想用在jupyter中使用虚拟环境:
安装虚拟环境时用:conda create -n xxx python=xxx ipykernel
进入该环境:activate xxx
激活该环境的kernel:python -m ipykernel install --user --name xxx --display-name "xxxxxx"
其实虚拟空间就是你在这里运行python,使用当前目录下的库,包等资源
在jupyter中使用虚拟环境,就是让jupyter找一个文件,就知道在哪里运行python,使用谁的包
上述命令会添加这个文件:
在C:\Users\xxx\AppData\Roaming\jupyter\kernels\xxx中
添加了一个kernel.json
内容一般如下:
{
"language": "python",
"display_name": "xxxxxx",
"argv": [ "D:\\Anaconda3\\envs\\xxx\\python.exe", "-m", "ipykernel_launcher", "-f", "{connection_file}" ]
}