No module named tensorflow in jupyter

后端 未结 13 1287
梦如初夏
梦如初夏 2020-12-04 18:06

I have some imports in my jupyter notebook and among them is tensorflow:

ImportError                               Traceback (most recent call last)


        
13条回答
  •  执念已碎
    2020-12-04 18:53

    I had the same problem, and solved it by looking at the output of:

    jupyter kernelspec list

    which outputs the kernel information:

    python2 /Users/Username/Library/Jupyter/kernels/python2 
    python3 /Users/Username/Library/Jupyter/kernels/python3
    

    Notice that the path points to the Jupyter kernel for the user. To use it within the the Anaconda environment, it needs to point to the conda env you are using, and look something like Anaconda3\envs\Env_Name\share\jupyter\kernels\python3.

    So, to remove the Jupyter kernelspec, just use:

    jupyter kernelspec remove python3

    or jupyter kernelspec remove python2 if you're using python 2

    Now, the output of jupyter kernelspec list should point to the correct kernel.

    See https://github.com/jupyter/notebook/issues/397 for more information about this.

提交回复
热议问题