Setup modern Python environment with Homebrew

Based on http://ymotongpoo.hatenablog.com/entry/20120516/1337123564 Unfortunately, pythonbrew is owkn... Let's use virtualenv for switching multiple Python versions!

Install Python and related tools

I mainly use Python3 :) Latest Python3 version in Homebrew is Python 3.2.3.

% brew install python3
% /usr/local/share/python3/easy_install3 pip
% /usr/local/share/python3/easy_install3 virtualenv
% /usr/local/share/python3/easy_install3 virtualenvwrapper

Configuration in .zshrc

PYTHON_VER=3.2
export HOMEBREW_PREFIX=/usr/local
export VIRTUALENVWRAPPER_PYTHON=$HOMEBREW_PREFIX/bin/python$PYTHON_VER
export VIRTUALENV_BIN=$HOMEBREW_PREFIX/share/python3
export WORKON_HOME=$HOME/.virtualenvs
. $VIRTUALENV_BIN/virtualenvwrapper.sh
export PATH=$VIRTUALENV_BIN:$PATH

mkvenv ()
{
    base_python=`which python$1` 
    mkvirtualenv --distribute --python=$base_python $2
}

Try!

% source .zshrc
% mkvenv 3.2 dev
(dev)% which python
$WORKON_HOME/dev/bin/python
(dev)% python -V                                   
Python 3.2.3
(dev)% pip install tornado
(dev)% deactivate
% source $WORKON_HOME/dev/bin/activate
(dev)% 

Recommended Posts

Setup modern Python environment with Homebrew
Build a modern Python environment with Neovim
homebrew python environment construction
Python environment with docker-compose
Virtual environment with Python 3.6
Image Processing with Python Environment Setup for Windows
Install Python environment with Anaconda
Manage python environment with virtualenv
Build python3 environment with ubuntu 16.04
Prepare python3 environment with Docker
Build python environment with direnv
Get started with Python! ~ ① Environment construction ~
Python practice_Virtual environment setup ~ Django installation
Build python virtual environment with virtualenv
Build Mysql + Python environment with docker
Create a virtual environment with Python!
Building a virtual environment with Python 3
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
Manage each Python version with Homebrew
pytorch @ python3.8 environment construction with pipenv
Prepare Python development environment with Atom
[Pyenv] Building a python environment with ubuntu 16.04
[Ubuntu 18.04] Python environment construction with pyenv + pipenv
[Python] Building an environment with Anaconda [Mac]
Change Python 64bit environment to 32bit environment with Anaconda
Building a Python3 environment with Amazon Linux2
Build Jupyter Lab (Python) environment with Docker
[Development environment] Python with Xcode [With screen transition]
Use smbus with python3 under pyenv environment
Note when creating an environment with python
[Python] Create a virtual environment with Anaconda
Building a Python 3.6 environment with Windows + PowerShell
Create Python + uWSGI + Nginx environment with Docker
Build Python environment with Anaconda on Mac
Publish your own Python library with Homebrew
Launch environment with LineBot + Heroku + Docker + Python
Build a python virtual environment with pyenv
Clean python environment with pythonz and virtualenv
Let's get along with Python # 0 (Environment construction)
Build AI / machine learning environment with Python
Introduced sip-4.14 in python3.2.2 environment with MacOS 10.7.4
Statistics with python
Python environment construction
python environment settings
Scraping with Python
Python with Go
python windows environment
Environment construction (python)
Twilio with Python
Integrate with Python
Play with 2016-Python
ROS environment setup ①
AES256 with python
Tested with Python
python starts with ()
python environment construction
with syntax (Python)
Python --Environment construction
Bingo with python
Zundokokiyoshi with python
Python environment construction