Install Python on Mac

There are some things to prepare before installing Python.

Install Homebrew. Since ruby is installed on MacOS, execute the following command from the terminal.

/usr/bin/ruby -e "$(curl -fsSL"  

Let's check the installation destination. $ which brew

To update Homebrew, run the following command. $ brew update && brew upgrade

pyenv Then install Pyenv. This is Python version control software. Normally, Python 2.7 is already installed on MacOS, but if you want to use multiple versions of Python, use this software. $ brew install pyenv
Then edit the .bash_profile in your home directory. Edit with vi or

export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"

Write to .bash_profile as follows.

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bash_profile
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bash_profile
$ echo 'eval "$(pyenv init -)"' >> ~/.bash_profile

afterwards, $ source .bash_profile
Refresh with.

Now you're ready to install Python. Now let's actually install it. You can check the list of installable Python with the following command.

$ pyenv install -l  
Available versions:  

Install a specific version. $ pyenv install 3.5.1

Check the installed version.

$ pyenv versions  
* system (set by /Users/yoshi/.pyenv/version)  

To select the version you actually want to activate $ pyenv global 3.5.1
will do. When I check it,

$ pyenv versions  
* 3.5.1 (set by /Users/yoshi/.pyenv/version)  
like*The mark has been changed.

You have now installed the 3.5.1 version. Let's check. $ which python
/Users/username/.pyenv/shims/python It is installed in .pyenv in your home directory. Let's actually start it.

$ python  
Python 3.5.1 (default, Jul  5 2016, 01:34:21)  
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)] on darwin
Type "help", "copyright", "credits" or "license" for more information.  

Recommended Posts

Install Python on Mac
Install Python 3 on Mac
Install Python 3.4 on Mac
Install pandas 0.14 on python3.4 [on Mac]
python on mac
Install Python 3.7 Anaconda on MAC, but Python 2
Install python3 on Mac (El Capitan)
Steps to install python3 on mac
Install Tensorflow on Mac
Install python on WSL
Install pyenv on mac
Install Python on Pidora.
Install Scrapy on python3
Install Ansible on Mac
Install Python3.4 on CentOS 6.6
Install python on windows
Install Python 2.7.3 on CentOS 5.4
Install Python 3.3 on Ubuntu 12.04
Install Caffe on Mac
Install mecab on mac
Install mecab-python on Mac
Install Python 3.6 on Docker
Install Python 3.8 on RHEL 8 (AppStream)
Install watchdog on Windows + Python 3.3
install python
Install Python 3.8 on CentOS 7 (SCL)
Install module on Anaconda (Mac)
Install OpenPose on mac (Catalina)
Install numba on your Mac
Handling of python on mac
Update python on Mac to 3.7-> 3.8
Install OpenCV on Ubuntu + python
Notes on installing Python on Mac
Python --Install MySQLDB on EC2
Install Django on your Mac
Install pillow on Mac OSX 10.9
[Mac] Tips: Install pyquery on Mac [pyquery]
Install Python 3.8 on CentOS 8 (AppStream)
[Python] [Chainer] [Windows] Install Chainer on Windows
Install Python3 on Mac and build environment [Definitive Edition]
Install Python venv --VSCode --GitHub integration environment on Mac
Install selenium on Mac and try it with python
Install Python environment on local PC (pyenv, venv on Mac)
Install Python Pillow on Amazon Linux
Install Python 3.8 on Ubuntu 18.04 (OS standard)
If python on mac goes missing
Install Python3 on Sakura server (FreeBSD)
Install anaconda on Mac → Add Library
How to install mysql-connector-python on mac
Install Python 3.8 on Ubuntu 20.04 (OS standard)
Install python2.7 on windows 32bit environment
Steps to install matplotlib on Mac
Install xgboost (python version) on Windows
Create a Python environment on Mac (2017/4)
Install Python on Windows + pip + virtualenv
Install Sphinx on Mac OS X
Install Pytorch on Blender 2.90 python on Windows
Python environment construction memo on Mac
Install Scipy on Mac OS Sierra
How to install OpenCV on Mac
Install mitmproxy on Mac OS X