This is your own procedure memo for building a Python Django environment (& environment for machine learning). It consisted of "pyenv" + "pyenv-virtualenv" + "Anaconda".
Terminal
$ xcode-select --install (#Click the install button when the pop-up window launches)
Terminal
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
<reference>
$ brew update && brew upgrade (#Homebrew update)
(Ref 1-2) -Comfortable python environment with MacOS, Homebrew and pyenv.
Terminal
$ brew install pyenv
$ brew install pyenv-virtualenv
Terminal
$ vim ~/.bash_profile (# .bash_Describe the following contents in the profile file)
## Set path for pyenv
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PATH:$PYENV_ROOT/bin:$PYENV_ROOT/shims"
# eval "$(pyenv init -)" (#Set as needed)
# eval "$(pyenv virtualenv-init -)" (#Set as needed)
Terminal
$ source ~/.bash_profile (#Reflect the settings)
Terminal
$ pyenv install -l | grep anaconda3 (#The latest Anaconda(Python3 series)Check the version of)
$ pyenv install anaconda3-4.3.1 (#Install the latest version)
$ pyenv install anaconda2-4.3.1 (#Install Python2 system as well)
$ python --version
Python 3.6.1 :: Anaconda 4.3.1 (x86_64)
$ pyenv global anaconda3-4.3.1 (#The specified version of the virtual environment is set for all directories)
$ pyenv versions
system
anaconda2-4.3.1
* anaconda3-4.3.1
Terminal
$ pyenv virtualenv anaconda3-4.3.1 django001
(# "django001"With the name, version"anaconda3-4.3.1"Create a new virtual environment for)
$ pyenv versions
system
anaconda2-4.3.1
* anaconda3-4.3.1
django001
(#Created earlier in a virtual environment that can be specified with pyenv"django001"Is added)
Terminal
$ mkdir mydjango (#Directory to install Django"mydjango"Create)
$ cd mydjango (# "mydjango"Move to directory)
$ pyenv local django001 (# "mydjango"Virtual environment in the directory"django001"The set)
$ pyenv versions
system
anaconda2-4.3.1
anaconda3-4.3.1
* django001
(#You can automatically enter the virtual environment created by virtualenv just by moving to the specified directory.)
<reference>
$ pyenv local --unset (#Cancel local setting)
$ pyenv uninstall django001 (#Delete the virtual environment created by virtualenv)
(Ref 3-7) -[Note from installing Homebrew to building an Anaconda environment for Python with pyenv] (http://qiita.com/oct_itmt/items/2d066801a7464a676994)
--[Understanding environment variable settings for PATH (Mac OS X)] (http://qiita.com/soarflat/items/d5015bec37f8a8254380)
-[Build a python environment for each directory with pyenv-virtualenv] (http://qiita.com/niwak2/items/5490607be32202ce1314)
-[3 types of workarounds for activate collision problem when pyenv and anaconda coexist] (http://qiita.com/y__sama/items/f732bb7bec2bff355b69)
-[A story about using pyenv, which I hated without eating, was too convenient to sit down] (http://qiita.com/who_you_me/items/09f572c842b1c3fea015)
-[Flow of inserting anyenv, pyenv, pyenv-virtualenv, anaconda for switching python development environment] (http://takemikami.com/2016/10/20/python-anyenv-pyenv-pyenvvirtualenv-anaconda.html)
-[I want to create a nice Python development environment for my new Mac] (http://qiita.com/nakazonor/items/258496fc442f7937c478#_reference-40a15e06a5e731d455ef)
Terminal
$ pip install --upgrade pip
$ conda update -y conda (#It is not used here, but it is used when installing the machine learning library. See the article below for details)
(reference) -[[Updated from time to time] pyenv + Anaconda (Ubuntu 16.04 LTS) prepares Python development environment for machine learning all-in-one] (http://blog.algolab.jp/post/2016/08/21/pyenv-anaconda-ubuntu/)
Terminal
$ cd mydjango
$ pip install django (# "mydjango"Install the latest version of Django in your directory)
<reference>
(# "pip install django==1.10"You can specify the version to install with)
$ pip list (#Check if Django is listed in the library list)
Django (1.11)
pip (9.0.1)
setuptools (27.2.0)
wheel (0.29.0)
(reference) -[From 0 to Django development environment construction to basic operation] (http://qiita.com/tonkatu05/items/d0422a2050d669c72f54)
that's all.
Recommended Posts