jupyter中不能用tensorflow


簡單記一下

先進入虛擬環境(比如我的source activate tf)。

然后在該環境下安裝jupyter和ipython

pip install jupyter

pip install ipython

查看安裝的jupyter和ipython是否在當前環境下

(tf) xxx@xxx:~/Desktop/Tasks/tf$ which jupyter
/home/xxx/.conda/envs/tf/bin/jupyter
(tf) xxx@xxx:~/Desktop/Tasks/tf$ which ipython
/home/xxx/.conda/envs/tf/bin/ipython

如果顯示在anaconda下,或者.local文件下,那么就是全局的ipython或者jupyter。可以先退出該環境,卸載ipython和jupyter,直到which ipython/jupyter不顯示任何信息。在進入虛擬環境安裝juptyer和ipython。我自己是試了幾次卸載安裝才弄對,然后退出環境又去全局安裝jupyter和ipython。最后顯示虛擬環境和全局是分開了的。

最后,還是在虛擬環境中操作,輸入下面的命令就可以了

ipython kernelspec install-self --user

看到

[InstallNativeKernelSpec] Installed kernelspec python3 in /home/xxx/.local/share/jupyter/kernels/python3

就可以啦。

上圖


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM