如何在Ubuntu下安裝Anaconda及搭建環境安裝TensorFlow深度學習框架
https://blog.csdn.net/u010899985/article/details/59482825
史上最全的ubuntu16.04安裝nvidia驅動+cuda9.0+cuDnn7.0
https://blog.csdn.net/fdqw_sph/article/details/78745375
Ubuntu 16.04 上安裝 CUDA 9.0 詳細教程
https://blog.csdn.net/QLULIBIN/article/details/78714596
Ubuntu 16.04 + Nvidia 顯卡驅動 + Cuda 8.0 (問題總結 + 解決方案)
https://blog.csdn.net/zafir_410/article/details/73188228?utm_source=itdadao&utm_medium=referral
Ubuntu16.04深度學習環境配置——Anaconda(基於Python3.5)+Tensorflow(GPU版本)的安裝以及在PyCharm中的使用
https://blog.csdn.net/AllenIrving/article/details/80406709
問題總結:
Q1:我在安裝anaconda過程中,直接跳過了PATH的安裝如下圖:
遇到這種情況只能自己添加了:
1、到根目錄下,打開終端並輸入:
sudo gedit ~/.bashrc
2、在.bashrc文件末尾添加的路徑:
#export PATH=/home/xxx/anaconda3/bin:$PATH
保存並關閉文件
3、使其立即生效,在終端執行:
source ~/.bashrc
4、測試anaconda安裝成功:
anaconda -V
5、打開anaconda-navigator
$ anaconda-navigator
Q2: 安裝Anaconda后,需要安裝Tensorflow出現問題:
conda create -n tensorflow python=3.6 #我下的TensorFlow對應的Python是3.6版本,那么我就使用這行
錯誤信息:
CondaHTTPError: HTTP 000 CONNECTION FAILED for url <https://repo.continuum.io/pkgs/main/win-64/repodata.json.bz2>
Elapsed: -
解決辦法:
sudo gedit ~/.condarc
刪除文件中 -defaults那一行即可。
Anaconda使用:
激活和關閉環境:
source activate tensorflow #激活環境(這里tensorflow 是你自己的環境名稱) source deactivate tensorflow #關閉環境
調用激活后環境中的jupyter notebook(一定要給激活環境安裝jupyter notebook)
$ ipython notebook
修改jupyter的目錄:
jupyter notebook --generate-config
安裝Tensorflow:
1、換源(如果出現URL錯誤的話)
2、安裝Tensorflow-gpu
conda install tensorflow-gpu
如果失敗試試:
pip install tensorflow-gpu
如果pip3 install --upgrade tensorflow-gpu失敗的話,先安裝pip
sudo apt install python3-pip
或者:
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/gpu/tensorflow_gpu-1.8.0-cp36-cp36m-linux_x86_64.whl
安裝keras:(如果需要)
pip install keras
3、測試Tensorflow
import tensorflow as tf a = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[2, 3], name='a') b = tf.constant([1.0, 2.0, 3.0, 4.0, 5.0, 6.0], shape=[3, 2], name='b') c = tf.matmul(a, b) sess = tf.Session(config=tf.ConfigProto(log_device_placement=True)) print(sess.run(c))
4、查看Tensorflow版本號
python import tensorflow as tf tf.__version__
或者:
anaconda search -t conda tensorflow
Ubuntu關機重啟命令簡介:
重啟命令:
1、reboot
2、shutdown -r now 立刻重啟(root用戶使用)
3、shutdown -r 10 過10分鍾自動重啟(root用戶使用)
4、shutdown -r 20:35 在時間為20:35時候重啟(root用戶使用)
如果ubantu分區根目錄空間太小,可以通過掛載方式解決:
http://forum.ubuntu.org.cn/viewtopic.php?f=86&t=80493