tensorflow-gpu以及jupyter kernel添加新创建虚拟环境的安装配置

前言

很久没用jupyter写代码,然后昨天写时候发现无法输入代码了,不论是code还是markdown都不能输入,弄了很久还是不能输入代码,然后试着重装anaconda,但是重装后还是不能用jupyter lab输入代码,只能用notebook。而且重装之后环境什么的都没了,所以正好把环境配置全部写一遍。

安装tensorflow1.X-gpu

安装好anaconda后,conda install tensorflow-gpu==1.X就能安装了,也不用另外去配置cuda和cudnn,不过前提是能*之类的吧,不然会下载的很慢。然后看下测试结果
tensorflow-gpu以及jupyter kernel添加新创建虚拟环境的安装配置

新建虚拟环境以及安装tensorflow2.0-gpu

首先在anaconda中新建一个虚拟环境conda create -n tf2.0 python=3.7
然后**虚拟环境 activate tf2.0
和上面的一样,**虚拟环境后安装tf2.0,conda install tensorflow-gpu==2.0
最后把新建的tf2.0环境加入jupyter的kernel
python -m ipykernel install --user --name tf2.0 --display-name "kernel的名字,可以随便取"
然后测试一下
tensorflow-gpu以及jupyter kernel添加新创建虚拟环境的安装配置
到这环境就重新安装好了,至于其他的库以后用到再安装就好了。

最后

有没有大神解答一下,为什么jupyter lab会出现无法输入代码的问题,我看了命令行运行没有报错,但是mode edit 显示却是not trust,但是jupyter lab里面又不能trust,使用jupyter trust XXX.ipynb也没用,难道我以后就不能用jupyter lab了吗?