Note: Python environment

Marvin
Marvin
Sep 4, 2018 · 2 min read

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

Written by

Marvin

A lovely guy

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade