[PYTHON] Memo on Mac OS X

Memo on Mac OS X

Environment: Mac OS X 10.9.4 (Mavericks) Assumption: homebrew installed

Install pyenv

$ brew install pyenv-virtualenv pyenv

Add the following to ~ / .bashrc and ~ / .zshrc

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

After adding, execute the following

$ source ~/.zshrc

If you execute the following command and the version of pyenv is displayed, it is successful

$ pyenv -v
pyenv 20140705

bonus

Added a guy who automates pyenv rehash (although not required). rehash It's easy to forget so put it in

git clone https://github.com/yyuu/pyenv-pip-rehash.git ~/.pyenv/plugins/pyenv-pip-rehash

Install python from pyenv

List of installable versions

$ pyenv install -l

Python installation

$ pyenv install 3.4.1

Check the installed version

$ pyenv versions

Version switching (global)

The specified version is used as a whole.

$ pyenv global 3.4.1

Version switching (local)

The specified version is used directly under that directory.

$ pyenv local 3.4.1

Uninstall

$ pyenv uninstall 3.4.1

Hello World

Save the following as hello.py

print("Hello World")

Try to run

$ python hello.py
Hello World

Note

I heard a rumor from Homebrew that Ricty (fontforge) cannot be installed when using Python3 system with pyenv. I haven't verified it, but for the time being, it's a memo. http://d.hatena.ne.jp/riocampos+tech/20140406/pyenv_must_be_set_python2_as_python

Recommended Posts

Memo on Mac OS X
Install mitmproxy on Mac OS X
Install pgmagick on Mac OS X 10.9
Installed aws-cli On Mac OS X Lion
Mac OS X development environment construction memo
Run NASA CEA on Mac OS X
Run Zookeeper x python (kazoo) on Mac OS X
Shpinx (Python documentation builder) on Mac OS X
Preparing to use aws cli on Mac OS X
Building an environment for "Tello_Video" on Mac OS X
Very easy to install SciPy on Mac OS X
Try using E-Cell 4 on Windows 7 or Mac OS X
Build a Python development environment on Mac OS X
Install PyQt5 with homebrew on Mac OS X Marvericks (10.9.2)
Installation of scikit-learn (Mac OS X)
Python environment construction memo on Mac
Install Scipy on Mac OS Sierra
Using NAOqi 2.4.2 Python SDK on Mac OS X El Capitan
How to install Theano on Mac OS X with homebrew
Mac OS X Mavericks 10.9.5 Development environment construction
Get started with the Python framework Django on Mac OS X
Linux x memo
How to erase Python 2.x on Mac.
Mac OS Preferences
python on mac
GeoDjango + SQLite environment construction on OS X
Kivy-Android Memo (MAC)
Install lp_solve on Mac OS X and call it with python.
How to install Theano on Mac OS X 10.10 (using pyenv, anaconda)
[Just a note] Until Keras + TensorFlow works on Mac OS X Sierra
Preparing to run ImageMagick + im4java on Mac OS
Put Python 2.7.x on Mac OSX 10.15.5 with pyenv
Mac OS X Mountain Lion 10.8.5 Development environment construction
Installing TensorFlow 0.11.0rc2 on OS X El Capitan (10.11.6)
Install Tensorflow on Mac
Install pyenv on mac
Pyenv + virtualenv on Mac
Install Ansible on Mac
Install Python on Mac
numba installation on mac
Run OpenMVG on Mac
Install Python 3.4 on Mac
Install Caffe on Mac
Install mecab on mac
Install mecab-python on Mac
Try deepdream on Mac
Build a machine learning Python environment on Mac OS
How to install caffe on OS X with macports
Minimum memo when using Python on Mac (pyenv edition)
Create a Python development environment on OS X Lion
pangolin x python x mac os build failed memorandum unsolved
When import tkinter is not possible on Mac OS X 10.11.3 (El Capitan) + pyenv + Python 3.5.1.
Steps to use the AWS command line interface (Python / awscli) on Mac OS X
NTP configuration memo on Linux
Word Count with Apache Spark and python (Mac OS X)
Notes on installing dlib on mac
Pyramid + mongodb environment on Mac
[Memo] Display Jupyter Notebook on PC in monospaced font (Mac)
Introducing delocate, a wheel package utility for Mac OS X
Install pygame on python3.4 on mac
Install tomcat 9 on Cent OS 8