Ubuntu 18.04 深度学习环境搭建

开启ssh

安装openssh-server。

sudo apt-get install openssh-server



Ubuntu 镜像源修改

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

sudo vim /etc/apt/sources.list

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
#deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse

sudo apt-get update
sudo apt-get upgrade


安装python3

sudo apt install python3-pip

修改pip源

vim ~/.pip/pip.conf
#ali的pip.conf配置
[global]
index-url = http://mirrors.aliyun.com/pypi/simple
[install]
trusted-host = mirrors.aliyun.com

安装jupyter

pip3 install jupyter

jupyter notebook --generate-config
jupyter notebook password

jupyter notebook --ip 0.0.0.0


安装anaconda
wget https://repo.continuum.io/archive/Anaconda3-5.1.0-Linux-x86_64.sh
bash ~/anaconda3/Anaconda3-5.1.0-Linux-x86_64.sh


source /home/keras/.bashrc

conda修改国内源
conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/
conda config --set show_channel_urls yes


jupyter远程登陆设置
jupyter notebook --generate-config
jupyter-notebook password


vim ~/.jupyter/jupyter_notebook_config.py 
c.NotebookApp.ip='*'


conda 创建环境

conda create -n dl python=3.6

source activate dl


安装tensorflow
conda create --name tensorflow python=3.5 jupyter
source activate tensorflow
pip install --ignore-installed --upgrade https://storage.googleapis.com/tensorflow/linux/cpu/tensorflow-1.6.0-cp35-cp35m-linux_x86_64.whl


验证tensorflow
vim test.py
# Python
import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))

python test.py


安装keras
pip install keras

安装pytorch-cpu

conda install pytorch -c soumith


你可能感兴趣的:(人工智能)