$ python --version
Python 2.7.10
$ which python
/usr/bin/python
If you install it with Homebrew, it will be convenient because it will symbolically link python3.x to the python3
command or the pip
command described later.
--XCode is already installed --homebrew is already installed
$ brew search python
app-engine-python [email protected] micropython python-markdown wxpython
boost-python gst-python python python3 zpython
caskroom/cask/kk7ds-python-runtime caskroom/cask/mysql-connector-python
brew install python3
~/.bash_profile
export PATH=/usr/local/bin:$PATH
$ source ~/.bash_profile
$ python -V
Python 2.7.10
$ python3 -V
Python 3.6.1
Python package manager. It will come with you when you install python3.
$ pip3 list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
setuptools (32.2.0)
wheel (0.29.0)
Put pip.conf
, specify the format, and it was warned, so it corresponds.
Mac seems to be in $ HOME / Library / Application Support / pip / pip.conf
, but I didn't have it, so I created it.
$ cd /Users/kumanoshuta/Library/"Application Support"
$ mkdir pip
$ cd pip
$ vi pip.conf
[list]
format=columns
$ pip3 list
Package Version
---------- -------
pip 9.0.1
setuptools 32.2.0
wheel 0.29.0
It provides a virtual environment for switching the version of python itself and the packages used.
I'm wondering if version switching is necessary or if docker or vergrant is fine, so I'll omit it.
$ pip3 install django
Collecting django
Downloading Django-1.11.2-py2.py3-none-any.whl (6.9MB)
100% |████████████████████████████████| 7.0MB 207kB/s
Collecting pytz (from django)
Downloading pytz-2017.2-py2.py3-none-any.whl (484kB)
100% |████████████████████████████████| 491kB 1.7MB/s
Installing collected packages: pytz, django
Successfully installed django-1.11.2 pytz-2017.2
$ pip3 list
Package Version
---------- -------
Django 1.11.2
pip 9.0.1
pytz 2017.2
setuptools 32.2.0
wheel 0.29.0
$ django-admin startproject mysite
$ python3 manage.py runserver 0.0.0.0:8000
Performing system checks...
System check identified no issues (0 silenced).
You have 13 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions.
Run 'python manage.py migrate' to apply them.
June 13, 2017 - 04:16:41
Django version 1.11.2, using settings 'mysite.settings'
Starting development server at http://0.0.0.0:8000/
I got an error, but I was able to start it.
Next, do DB settings
Recommended Posts