Setup Procedure for Python Development Environment


This is a setup procedure for Python development environment including the following tools:

  • pyenv
  • pyenv-virtualenv
  • pyenv-pip-rehash
  • virtualenv
  • TensorFlow
  • matlab

🍄 Installation for pyenv

brew install pyenv-virtualenv pyenv homebrew/boneyard/pyenv-pip-rehash

🐠 Configuration for pyenv

Open .bashrc or .zshrc and add the following configuration:

# python
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8

# pyenv
export PYENV_ROOT="${HOME}/.pyenv"
if [ -d "${PYENV_ROOT}" ]; then
export PATH=${PYENV_ROOT}/bin:$PATH
eval "$(pyenv init -)"
fi

🎳 Installation for python in pyenv

# Show a list of python versions which you can install
pyenv install -l

# Install Python 2.7.11
pyenv install 2.7.11

# Install Python 3.5.2
pyenv install 3.5.2

# Check installed version
pyenv versions

# Set global version
pyenv global 3.5.2

# install pip
sudo easy_install pip

🐯 Installation for virtualenv

# Install or upgrade virtualenv
sudo pip install --upgrade virtualenv

😸 Installation for TensorFlow

# Create virtual environment
$ virtualenv --system-site-packages ~/tensorflow

# Activate the environment
$ source ~/tensorflow/bin/activate

# Please check : https://www.tensorflow.org/get_started/os_setup.html
# Mac OS X, CPU only, Python 2.7:
(tensorflow)$ export TF_BINARY_URL=https://storage.googleapis.com/tensorflow/mac/tensorflow-0.9.0-py2-none-any.whl

🐰 Install matlab

brew install freetype
brew install libpng

sudo pip install matplotlib

🐹 Configuration for matlab

Download configuration template file:

wget https://raw.githubusercontent.com/matplotlib/matplotlib/master/matplotlibrc.template -P ~/.matplotlib/matplotlibrc

Open file by vi ~/.matplotlib/matplotlibrc and set following configuration:

backend : TkAgg

🖥 Recommended VPS Service

VULTR provides high performance cloud compute environment for you. Vultr has 15 data-centers strategically placed around the globe, you can use a VPS with 512 MB memory for just $ 2.5 / month ($ 0.004 / hour). In addition, Vultr is up to 4 times faster than the competition, so please check it => Check Benchmark Results!!