ubuntu 18.04 深度学习环境搭建

下载openssh-server

sudo apt-get install openssh-server


镜像修改

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


安装pip

sudo apt-get install python3-pip

sudo pip3 install --upgrade pip



修改pip源

sudo  vim ~/.pip/pip.conf

#ali的pip.conf配置

[global]

index-url = http://mirrors.aliyun.com/pypi/simple

[install]

trusted-host = mirrors.aliyun.com



安装jupyter


sudo apt-get install 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

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容