Building a python environment with virtualenv and direnv

Make python version control and build a virtual environment as easy as possible without using the system python.

Version control for the python interpreter

Install pythonz

$ curl -kL https://raw.github.com/saghul/pythonz/master/pythonz-install | bash
$ echo '[[ -s $HOME/.pythonz/etc/bashrc ]] && source $HOME/.pythonz/etc/bashrc' >> $HOME/.bashrc
$ exec $SHELL

Install and list python

$ pythonz list -a #Checking which python can be installed
$ pythonz install 3.6.0
#List of installed python
$ pythonz list

User default python environment settings

Install virtualenv

Only then you have to use the system python

$ sudo pip install virtualenv
( or $ pip install --user virtualenv)

Environment construction for default

$ mkdir -p $HOME/.virtualenvs
$ virtualenv -p $HOME/.pythonz/pythons/CPython-3.6.0/bin/python $HOME/.virtualenvs/default
$ echo ". $HOME/.virtualenvs/default/bin/activate" >> $HOME/.zshrc
$ exec $SHELL

Environment construction for each project

Install direnv

Premise that go is installed

$ go get github.com/direnv/direnv
$ cd $GOPATH/src/github.com/dirnev/direnv
$ go install
$ echo 'type direnv > /dev/null 2>&1 && eval "$(direnv hook bash)" ' >> $HOME/.zshrc

How to use direnv

$ mkdir -p project
$ cd project
$ direnv edit .

..envrc


layout python $(pythonz locate 3.6.0)

reference

Building a Python development environment (pythonz, virtualenv, direnv)

Recommended Posts

Building a python environment with virtualenv and direnv
Building a virtual environment with Python 3
Build a python virtual environment with virtualenv and virtualenvwrapper
Build a python virtual environment with virtualenv and virtualenvwrapper
[Pyenv] Building a python environment with ubuntu 16.04
Building a Python3 environment with Amazon Linux2
Building a Python 3.6 environment with Windows + PowerShell
Clean python environment with pythonz and virtualenv
Building a Python environment with WLS2 + Anaconda + PyCharm
Commands for creating a python3 environment with virtualenv
Work in a virtual environment with Python virtualenv.
Manage python environment with virtualenv
Build python environment with direnv
Building a Python virtual environment
Building a Python virtual environment
Recommendation of building a portable Python environment with conda
Building a Docker working environment for R and Python
I made a Python3 environment on Ubuntu with direnv.
Building and enabling a python virtual environment, etc. (venv)
conda memorandum: Building a Python environment with supercomputer ITO
Building a kubernetes environment with ansible 2
Building a Python environment on Mac
Build python virtual environment with virtualenv
Building a Python environment on Ubuntu
Create a virtual environment with Python!
Building a kubernetes environment with ansible 1
Building a Python environment on a Mac and using Jupyter lab
[Python] Building an environment with Anaconda [Mac]
[Python] Create a virtual environment with Anaconda
A memo with Python2.7 and Python3 on CentOS
[Mac] Building a virtual environment for Python
Build a python virtual environment with pyenv
Build Python development environment (pythonz, virtualenv, direnv)
Build a modern Python environment with Neovim
Building a Python development environment for AI development
Building a Docker working environment for R and Python 2: Japanese support
Build a 64-bit Python 2.7 environment with TDM-GCC and MinGW-w64 on Windows 7
Building a Windows 7 environment for getting started with machine learning with Python
Build a Python environment on your Mac with Anaconda and PyCharm
Create a C ++ and Python execution environment with WSL2 + Docker + VSCode
Create a simple Python development environment with VS Code and Docker
LaTeX and R (a little Python) environment construction with SublimeText3 (Windows)
Python3 TensorFlow environment construction (Mac and pyenv virtualenv)
Recommended environment and usage when developing with Python
[AWS] Create a Python Lambda environment with CodeStar and do Hello World
Build a python environment with ansible on centos6
Building an Anaconda environment for Python with pyenv
ffmpeg-Build a python environment and split the video
Create a virtual environment with conda in Python
Manage Python multiple version environment with Pythonz, virtualenv
[Python] Build a Django development environment with Docker
Create a python3 build environment with Sublime Text3
Developed and verified with multiple python versions with direnv
[Python] Web development preparation (building a virtual environment)
A memo when creating a python environment with miniconda
Build a virtual environment with pyenv and venv
Launch a web server with Python and Flask
Think about building a Python 3 environment in a Mac environment
python development environment -use of pyenv and virtualenv-
Python environment with docker-compose
Build a Python environment with OSX El capitan