Anaconda2已安装过python2.7的情况下安装python3,并在jupyter notebook中添加python3

1.在控制台(cmd)输入
conda info -e
2.conda create --name snake python=3
##系统会自动在envs目录下创建文件夹snake
3.通过指令activat和deactivate能够切换环境
代码如下:

C:\Users\Administrator>conda -V
conda 4.6.9

C:\Users\Administrator>python -V
Python 2.7.13 :: Anaconda 4.0.0 (64-bit)

C:\Users\Administrator>conda info -e
# conda environments:
#
base                  *  F:\Anaconda2
gl-env                   F:\Anaconda2\envs\gl-env
C:\Users\Administrator>conda create --name snake python=3
##python=3,这样写的好处是系统会自动下载和你环境匹配的python3.*
#
# To activate this environment, use:
# > activate snake
#
# To deactivate an active environment, use:
# > deactivate
#
# * for power-users using bash, you must source
#

验证是否安装成功
C:\Users\Administrator>conda -V
conda 4.6.9

C:\Users\Administrator>python -V
Python 2.7.13 :: Anaconda 4.0.0 (64-bit)

C:\Users\Administrator>activate snake

(snake) C:\Users\Administrator>conda -V
conda 4.6.9

(snake) C:\Users\Administrator>python -V
Python 3.7.3

非常感谢下边这位老哥:https://www.cnblogs.com/wxshi/p/6805120.html

因为我之前在jupyter notebook中已经有Python2,现在怎么添加python3呢?

C:\Users\Administrator>activate F:\Anaconda2\envs\snake

(snake) C:\Users\Administrator>python -m ipykernel install --user
Installed kernelspec python3 in C:\Users\Administrator\AppData\Roaming\jupyter\kernels\python3

(snake) C:\Users\Administrator>jupyter notebook

Anaconda2已安装过python2.7的情况下安装python3,并在jupyter notebook中添加python3_第1张图片

你可能感兴趣的:(Anaconda2已安装过python2.7的情况下安装python3,并在jupyter notebook中添加python3)