Jupyter notebook 指定 Python 解释器 anaconda
打开jupyter notebook新建一个文件,发现只有一个默认的解释器,我们在指定的虚拟环境中安装了我们想要的包后是无法使用的,只有在base环境下安装的包才是可用的
接下来解决上述问题:
conda search python # 查看当前conda镜像下能获得的版本
创建虚拟环境,安装指定的版本:
conda create -n emotiona_analysis python=3.6 # 创建名称为 emotiona_analysis 的虚拟环境,在此环境下安装 3.6python
关于创建虚拟环境更细讲解,观看博文:https://blog.csdn.net/weixin_44799217/article/details/113500335
将新创建的虚拟环境添加到 Jupyter notebook 中:
conda activate emotiona_analysis # 切换到虚拟环境emotiona_analysis
pip install ipykernel # 在tensorflow 中安装 ipykernel 包
python -m ipykernel install --name emotiona_analysis # 向 jupyter 中添加虚拟环境
打开 Jupyter notebook ,选择环境:
成功后的效果图:
移除已经安装在jupyter中的环境:
移除名字为env_xxx的环境
jupyter kernelspec remove env_xxx