Python development environment construction

Python development environment construction

New information on this page has been added to the following pages. Building Python environment with anyenv (2017/10/21)

Purpose

Build a Python environment that meets the following conditions on Mac

environment

Tool description

Installation

$ brew install pyenv-virtualenv

~/.zshrc


# pyenv
if which pyenv > /dev/null; then eval "$(pyenv init -)"; fi
export PYENV_ROOT=/usr/local/var/pyenv
# pyenv-virtualenv
if which pyenv-virtualenv-init > /dev/null; then eval "$(pyenv virtualenv-init -)"; fi
$ source ~/.zshrc

How to use

Python

Installation

When installing Python 3.4.3. Execute the following.

$ pyenv install 3.4.3

In my environment, with 3.4.3 installation

ERROR: The Python ssl extension was not compiled. Missing the OpenSSL lib?

I got the error, so follow here

CFLAGS="-I$(brew --prefix openssl)/include" \
LDFLAGS="-L$(brew --prefix openssl)/lib" \
pyenv install -v 3.4.3

Was executed and installed.

List of installable versions

$ pyenv install -l

List of installed versions

$ pyenv versions

Virtual environment

Creating a virtual environment

When creating a virtual environment for Python 3.4.3

$ pyenv virtualenv 3.4.3 myenv343

You can confirm that it is registered in the version of pyenv

$ pyenv versions
* system (set by /usr/local/var/pyenv/version)
  3.4.3
  myenv343

Set the environment in the folder

When creating a projecjt-a folder and setting the myenv343 environment

$ mkdir project-a
$ cd project-a
$ pyenv local myenv343

Now when you move to the project-a folder, you will automatically be in the environment of myenv 3.4.3.

$ cd project-a
(myenv343)$ python --version
Python 3.4.3
(myenv343)$ exit
$ cd ~
$ python --version
Python 2.7.10

Delete virtual environment

$ pyenv uninstall myenv343

Recommended Posts

Python development environment construction
python2.7 development environment construction
[MEMO] [Development environment construction] Python
Python environment construction
Environment construction (python)
python environment construction
Python --Environment construction
Python environment construction
python environment construction
[Python3] Development environment construction << Windows edition >>
Python development environment construction on macOS
Emacs Python development environment construction memo
python windows environment construction
homebrew python environment construction
About Python development environment
Development environment in Python
Mac environment construction Python
Python environment construction @ Win7
Python3 + venv + VSCode + macOS development environment construction
Windows + gVim + Poetry python development environment construction
Python + Anaconda + Pycharm environment construction
Django development environment construction memo
Python environment construction (Windows10 + Emacs)
CI environment construction ~ Python edition ~
Python environment construction For Mac
Anaconda3 python environment construction procedure
Python3 environment construction (for beginners)
Organize your Python development environment
Python environment construction and TensorFlow
[ev3dev × Python] Build ev3dev development environment
Python environment construction under Windows7 environment
[For organizing] Python development environment
django project development environment construction
Environment construction of python2 & 3 (OSX)
[MEMO] [Development environment construction] wine
Google App Engine / Python development environment construction procedure (late 2014)
Python development environment construction 2020 [From Python installation to poetry introduction]
QGIS3 Python plugin development environment construction with VSCode (macOS)
Environment construction of python and opencv
Python environment construction memo on Windows 10
Get started with Python! ~ ① Environment construction ~
Prepare Python development environment on Ubuntu
Anaconda python environment construction on Windows 10
[For beginners] Django -Development environment construction-
Python environment construction memo on Mac
Prepare your first Python development environment
Python environment construction (pyenv, anaconda, tensorflow)
Python development environment options for May 2020
Python environment construction (pyenv + poetry + pipx)
[MEMO] [Development environment construction] Jupyter Notebook
Vim + Python development environment setting memo
Emacs settings for Python development environment
Environment construction of python3.8 on mac
Python3 environment construction with pyenv-virtualenv (CentOS 7.3)
Install Python development environment on Windows 10
Python3 TensorFlow for Mac environment construction
Checking the NAOqi Python development environment
Ubuntu Desktop 20.04 development environment construction memo
pytorch @ python3.8 environment construction with pipenv
Development environment construction (2020 version, WSL2 + VcXsrv)
Prepare Python development environment with Atom