Note: Python environment

Marvin
2 min readSep 4, 2018

--

System: MacOS

Install Python:

Python is a so tricky program language, v2 and v3 inconsistent coexist for quite a long time, TensorFlow did’t support well to latest v3.7, so I need to switch to v3.6 as if I use TensorFlow, thus, I use pyenv as my version management, which help me quickly switch between different Python version

Install pyenv:

$ brew install pyenv
$ env PYTHON_CONFIGURE_OPTS="--enable-framework" // optional, in case you need backend function, such as matplotlib module
$ pyenv install 2.7.15 // install python
$ pyenv install 3.6.6
$ pyenv install 3.7.0
$ pyenv global 3.6.6 // switch python version$ python --version
Python 3.6.6

pyenv need these setting to help it run correctly:

$ echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
$ echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
$ echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc

Note: If you wish to update v3.6.6 -> v3.6.7, pyenv don’t support, If you wish to install the latest version similar like pyenv install 3.6.*, don’t support either, you can use pyenv install --list to find all the versions you can install

Install pip:

pip is a module management for Python, at the preview step, pyenv would install pipautomatically, so you can check them out directly:

$ pip --version
pip 18.0

Install IPython:

IPython is a powerful interactive shell for Python:

IPython console

--

--

Marvin
Marvin

Written by Marvin

Notebook for self-learning

No responses yet