Build a Python environment with OSX El capitan

It took a lot of time, so φ (..) memo memo I just tried to build it with homebrew and pyenv with the aim of coexisting multiple versions of python, but I had a lot of trouble. I also added anaconda.

I didn't think about anything at first

Suddenly bite brew install python, Permission denied - /usr/local/Frameworks I ate it. It seems to be eaten when updating from Yosemite to El capitan,

http://digitizor.com/fix-homebrew-permissions-osx-el-capitan/

After avoiding by referring to here I did brew uninstall python to use pyenv.

Install pyenv

When I thought that someone was putting it together, I felt that it was scattered, so I organized it. .. .. Install pyenv

$ brew install pyenv

Add the following to .bash_profile. (Without this, the python version will not change)

.bash_profile


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

This is fine. That's why I put it in the PATH.

$ source ~/.bash_profile

Then list the installable versions

$ pyenv install -l

~~ Insert the version you want to install ~~

**-> or something like that, it's anaconda these days! They said. So jump to the anaconda chapter **

~~```shell-session $ pyenv install 2.7.11

 ~~ Then I got angry again. .. .. It seems that python cannot be built without zlib
 So, I was guided to the main build problem page ~~

~~https://github.com/yyuu/pyenv/wiki/Common-build-problems~~

 ~~ Because I updated the OS, I survived with the following 2 commands. ~~

~~```shell-session
brew install readline xz
xcode-select --install
```~~
 ~~ It's sunny now ~~

~~```shell-session
$ pyenv global 3.5.1
```~~

 You can switch between them with ~~. Congratulations, congratulations.
 Next, let's try our best in virtualenv. ~~

# What is anaconda?

 When I looked it up, this one came out.

 [Python environment construction for those who aim to become data scientists 2016](http://qiita.com/y__sama/items/5b62d31cb7e6ed50f02c)

 ** The best conda that includes pip, pyenv and verticalenv! ** It seems. .. ..

 In the above article, Mac is swept away, but Mac seems to prefer pyenv-> anaconda. Was good! It wasn't wasted.
 (In the first place, I was asked why Mac?)

 So put anaconda from pyenv. I tried to put the latest version for the time being.

 (I first installed anaconda-2.4.0 because I wanted to use Python 2.x series, but it was unnecessary because anaconda itself includes version control similar to pyenv)

```shell-session
$ pyenv install anaconda3-2.4.0

The installation seems to have a long waiting time, so I switched to check the version after the installation.

$ pyenv global anaconda3-2.4.0
$ python --version
Python 3.5.0 :: Anaconda 2.4.0 (x86_64)

Yup. Is it good, is it good? By the way, the article that aims to be a data scientist has a solution to the problem of active conflict between pyenv and anaconda, but this seems to be unpleasant. .. ..

So, if you look at the following article by the same y__sama

Three types of workarounds for activate collision problem when pyenv and anaconda coexist

Disadvantages: pyenv local cannot be used.

It was written. Oh, after all? That's why we choose 3 types of workarounds, Plan 2.

OSX doesn't read .bachrc, so edit .bash_profile.

.bash_profile


export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
alias activate="source $PYENV_ROOT/versions/anaconda3-2.4.0/bin/activate"

This is fine.

$ source ~/.bash_profile

Well, it seems that it is better to update conda itself first just in case, so I will do it. It seems that only the second line is fine, but here is two steps. .. ..

$ conda update conda
$ conda update --all

With a total update of over 200MB, it will take some time, so please wait patiently. conda update anaconda seems to be useless. The version was rewound by dependency resolution.

Let's create a python 2.x environment. Because it is a good deal Python environment construction for those who aim to become data scientists 2016 Please refer to and put together as anaconda. .. ..

$ conda create -n anaconda2 python=2.7 anaconda

By the way, this command failed only after conda update. .. .. Make sure the environment is built.

$ conda env list

When entering, since the source is included in alias, it will only be activate.

activate anaconda2
(anaconda2) MacBook-Pro:~ tnoho$ python --version
Python 2.7.12 :: Anaconda 4.1.1 (x86_64)

Yes Yes. It feels good. When exiting

source deactivate

This made me happy. It was long. Python is hard. After that, I decided to use anaconda while referring to python environment construction 2016 for those who aim to be a data scientist. Maru.

Recommended Posts

Build a Python environment with OSX El capitan
Build a python environment with pyenv (OS X El Capitan 10.11.3)
Build a python data analysis environment on Mac (El Capitan)
Build a python virtual environment with pyenv
Build a modern Python environment with Neovim
Build a python environment with ansible on centos6
[Python] Build a Django development environment with Docker
Create a python3 build environment with Sublime Text3
Quickly build a Python Django environment with IntelliJ
Build a Python machine learning environment with a container
Build a python execution environment with VS Code
Build python3 environment with ubuntu 16.04
Build python environment with direnv
Build a Python environment offline
Build a python virtual environment with virtualenv and virtualenvwrapper
Build a python environment for each directory with pyenv-virtualenv
Build a python virtual environment with virtualenv and virtualenvwrapper
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
Build a python3 environment on CentOS7
Build a Python environment with WSL + Pyenv + Jupyter + VS Code
[Pyenv] Building a python environment with ubuntu 16.04
Building a Python3 environment with Amazon Linux2
Easily build a development environment with Laragon
Build Jupyter Lab (Python) environment with Docker
Build a blockchain with Python ① Create a class
Build a python environment on MacOS (Catallina)
[Python] Create a virtual environment with Anaconda
I want to build a Python environment
Build a Fast API environment with docker-compose
Build Python environment with Anaconda on Mac
[Linux] Build a jenkins environment with Docker
Build a Python + OpenCV environment on Cloud9
Upgrading Python module in OSX El Capitan
Build AI / machine learning environment with Python
[Linux] Build a Docker environment with Amazon Linux 2
Build a Python environment on your Mac with Anaconda and PyCharm
Build a Python execution environment using GPU with GCP Compute engine
Build a C language development environment with a container
Build a WardPress environment on AWS with pulumi
Build python environment with pyenv on EC2 (ubuntu)
Building a python environment with virtualenv and direnv
Simply build a Python 3 execution environment on Windows
Build a Python + bottle + MySQL environment with Docker on RaspberryPi3! [Easy construction]
Build Python development environment with Visual Studio Code
Building a Python environment with WLS2 + Anaconda + PyCharm
Build a Python environment on Mac (Mountain Lion)
Create a virtual environment with conda in Python
Build a Django environment with Vagrant in 5 minutes
Build an environment with pyenv, pyenv-virtualenv, jupyter on OS X El Capitan
Build a Python development environment on your Mac
[Memo] Build a virtual environment with Pyenv + anaconda
Build a simple Python virtual environment without pyenv
A memo when creating a python environment with miniconda
Build a virtual environment with pyenv and venv
Build a Django development environment with Doker Toolbox
Commands for creating a python3 environment with virtualenv
Work in a virtual environment with Python virtualenv.
Create a Python environment