First, Python is already installed on your Mac. You can use this, but I would like to use the homebrew version.
You can also use pyenv to manage installations and versions used. Here.
which python
/usr/bin/python
In the brew version, Python 2.x series and Python 3.x series can be installed, and Python 3.x series is installed as Python 3, so you can coexist without thinking. Here, I will use Python 2.x series for the time being.
brew info As you can see by python, it seems that pip is also installed.
brew install python
After installing, try which python again,
/usr/local/bin/python
The brew version (under / usr / local / bin /) is used. This is because / usr / local / bin has priority over / usr / bin by default, so if for some reason the PATH setting is not like that, .bash_profile etc. will take precedence. Define the ranking properly.
It seems that pip wraps setuptools, so update each tool.
pip install --upgrade setuptools
pip install --upgrade pip
It seems that python in the standard state does not include pip. In that case, you can install it with easy_install pip.
The list is
pip freeze
In can be confirmed. For details on each module, see
pip show <package_name>
You can see it at. The package is
/usr/local/lib/python2.7/site-packages
It seems to be installed in, but this seems to see the same location for both the original python and the brew version of python.
Install the required modules. For the time being, the following is sufficient.
pip install numpy
pip install matplotlib
pip install pillow
It seems that numpy is also installed when matplotlib is installed.
Django
For the time being, I'll also write the Django setup. Until It worked!
pip install django
You can also version it as> pip install django == 1.9.
django-admin.py startproject django_test
cd django_test
python manage.py runserver
Try accessing http://127.0.0.1:8000/ with your browser. It worked! Is OK.
There is a bug in 2.7.11 installed by brew and it doesn't start properly. It seems to be okay if 2.7.10 is already included. It doesn't seem to work for a clean install. I wrote about the countermeasures in here.
Recommended Posts