设置虚拟环境
conda create -n tf2 py=3.7
conda activate tf2
pip install tensorflow-gpu==2.0.0-beta0
ipython
import tensorflow as tf
tf.test.is_gpu_available()
这些命令执行过后,并不能检测到gpu
#查看安装的包,发现是base环境的包
pip list
正确做法
conda activate tf2
conda install ipykernel #this step
python -m ipykernel install --user --name 环境名称 --display-name "在jupyter中显示的环境名称"#and this step
pip install tensorflow-gpu==2.0.0-beta0
ipython
import tensorflow as tf
tf.test.is_gpu_available()
ok了 ,在ipython就能够启动虚拟环境并调用所需的包了,并能够在jupyter显示
参考资料:
Jupyter can’t find env Python kernels #57