1. 程式人生 > >Ubuntu上 使用jupyter notebook 執行Tensorflow準備工作

Ubuntu上 使用jupyter notebook 執行Tensorflow準備工作

前期比較順利,安裝Tensorflow卡住了。

從頭說起,安裝Anaconda沒啥說的,網上資料很多。最新版的Anaconda自帶jupyter notebook,不用另外安裝。獲取管理員許可權(命令列輸入: su root   再輸入密碼)。接著輸入:

jupyter notebook --allow

出現一大串:

                               

 往下找到 這樣的地址,單擊選擇開啟連結。即在瀏覽器中出現jupyter notebook。

最後單擊New選擇python版本即可。

下面安裝 Tensorflow:

按照網上搜出的命令 :pip install tensorflow 本該是沒問題的,但是出現了 Could not find  a version that satisfies the requirement  tensorflow(from versions: )No matching distribution found for  tensorflow 錯誤提示。百思不得其解。

後來查到目前tensorflow只支援到 python 3.6,而我下載的Anaconda是3.7。所以得開闢一個3.6的虛擬環境。於是繼續:

conda info --envs

這是用來檢視當前的python版本。現在要新建一個3.6版本的環境,命令列輸入:

conda create --name python36 python=3.6

其中python36只是為這個環境取的名字。這樣新環境建立好了,再轉至新環境中。輸入:

source activate python36

成功進入python36環境中。

再重新用pip安裝Tensorflow就可以下載了。並且這個環境中開啟的jupyter notebook 與剛剛python3.7中開啟的不一樣了。