最近在看李沐老师的pytroch教学,跟着动手实践发现了不少问题。
首先是创建虚拟环境却无法使用jupyter的问题。
使用conda创建虚拟环境
conda create -n d2l-zh python=3.8
conda activate d2l-zh
pip install d2l torch torchvision
完毕之后发现无法使用jupyter打开记事本,本人使用vscode作为编辑器,总是报错
The kernel failed to start due to the missing module 'ipykernel_launcher'. Consider installing this module. View Jupyter log for further details.
最后查询到stack overflow也有相同的情况,解决方法是:
卸载环境中的jupyter
python3 -m pip uninstall -y jupyter jupyter_core jupyter-client jupyter-console jupyterlab_pygments notebook qtconsole nbconvert nbformat jupyterlab-widgets nbclient ipykernel ipynb
之后再进行安装
conda install -c conda-forge --update-deps --force-reinstall ipykernel -y
试了一下,终于解决了前面jupyter无法运行的问题。