Creating an environment for deep learning from scratch Memo
=========== 2017/04/15 22:24 Addendum =============== A docker image created according to the method in this article https://hub.docker.com/r/gorogoroyasu/deeplearning-env Woke up in Please feel free to use it. ================ Addendum =================
Prepare ubuntu16 docker container and I built an environment in which python works.
Download ubuntu: 16.04 docker image, start the container and go inside the container.
sudo docker pull ubuntu:16.04
sudo docker run -d --name ubuntu16 ubuntu:16.04 /sbin/init
sudo docker exec -it ubuntu16 /bin/bash
Execute the following command in the container
apt update
apt-get install gcc g++ make git openssl libssl-dev libbz2-dev libreadline-dev libsqlite3-dev curl libopenblas-dev vim wget -y
git clone https://github.com/yyuu/pyenv.git ~/.pyenv
git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(pyenv init -)"' >> ~/.bashrc
echo 'eval "$(pyenv virtualenv-init -)"' >> ~/.bashrc
source ~/.bashrc
pyenv install 3.5.1
pyenv rehash
pyenv global 3.5.1
pip install --upgrade pip
pip install numpy
pip install matplotlib
afterwards,
find / -name matplotlibrc
Is near line 38 of the file that comes out,
backend : TKAgg
To
backend : Agg
change to.
This completes the environment construction.
In addition, I decided to output the graph as an image. The reason was that it seemed to be annoying. If you don't like images, please refer to here. [Reference]: http://qiita.com/hyt-sasaki/items/cebdd953a5b5cfde00df
Click here for sample code to output images.
import numpy as np
import matplotlib.pyplot as plt
x = np.arange(0, 1, 0.1)
y = x
plt.plot(x,y)
plt.savefig('plot.png')
plt.savefig ('hoge.png')
is outputting the image.
The output image looks like this. For the time being, if you only need a still image, I think this is enough.
Good vibes.
=========== 2017/04/16 14:58 Addendum ============
Since I am using a module called PIL on P.74,
pip install Pillow
Seems to be necessary.
To save images with PIL,
pil_img.save('hoge.png')
It seems that it should be done.
docker image has not been updated.
========================================
Recommended Posts