Install pyenv
brew install pyenv
Install a plugin to automate pyenv rehash
brew install pyenv-pip-rehash
Add pyenv information to the shell startup script (replace the zsh part in the case of bash)
echo 'export PYENV_ROOT="${HOME}/.pyenv"' >> ~/.zshrc
echo 'if [ -d "${PYENV_ROOT}" ]; then' >> ~/.zshrc
echo ' export PATH=${PYENV_ROOT}/bin:$PATH' >> ~/.zshrc
echo ' eval "$(pyenv init -)"' >> ~/.zshrc
echo 'fi' >> ~/.zshrc
exec $SHELL -l```
4) Install a specific version of python with pyenv
#### **`pyenv install 3.4.2`**
pyenv local 3.4.2
6) Install pip with easy_install
```sudo easy_install pip```
7) Confirm (in the directory where version was determined in step 5)
```which python```
/Users/Owner/.pyenv/shims/python
```python --version```
Python 3.4.2
```which easy_install```
/Users/Owner/.pyenv/shims/easy_install
```easy_install --version```
setuptools 2.1
```pip --version```
pip 1.5.6 from /Users/Owner/.pyenv/versions/3.4.2/lib/python3.4/site-packages (python 3.4)
The following is difficult to understand
1) When using pip, easy_install is used only when installing pip.
It's like buying Windows and not using IE after first installing Chrome in IE.
Because pip is a partial replacement for easy_install.
2) When installing pip, permission is denied without sudo. To touch directories that root needs.
Recommended Posts