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.
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.
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