Build a Python virtual environment that anyone can understand September 2016 (pyenv + virutalenv)

Introduction

This post is based on the assumption that Python + pyenv + virutalenv is installed. If you haven't installed the above, please refer to the post below.

Purpose of building a virtual environment

Python, which is included as standard in the OS, is provided for the libraries and applications included in the OS. Therefore, if you use it for free programming, you run the risk of problems with the apps and libraries it depends on. To avoid the above, it is better to create a virtual environment when programming.

To do

The environment is Mac OSX 10.10.5, and it is assumed that Xcode and homebrew are installed.

Execution procedure

First check the environment path

First, check if the path is in Python under pyenv.

$ pyenv which python
$ pyenv which pip

It is OK if you can execute the above command and confirm that Python and pip are under .pyenv.

Build a virtual environment with virtualenv

Execute by specifying the Python version and virtual environment name.

$ pyenv virtualenv 3.5.2 test_3.5.2

Link virtual environment and directory with pyenv

First, create a directory on virtualenv. You can create the directory anywhere.

$ mkdir ~/Documents/test_project

Navigate to the directory you created.

$ cd ~/Documents/test_project

Associate the virtual environment of virtualenv with the directory.

$ pyenv local test_3.5.2

Supplement

The virtual environment built with virtualenv can be deleted below.

$ pyenv uninstall test_3.5.2

in conclusion

If you have any questions or mistakes, please comment. I hope that what my friends have taught me will help more people.

Recommended Posts

Build a Python virtual environment that anyone can understand September 2016 (pyenv + virutalenv)
Anyone can understand how to build an initial environment for Python on Mac September 2016 (pyenv + virutalenv)
Build a python virtual environment with pyenv
Try using virtualenv, which can build a virtual environment for Python
[Memo] Build a virtual environment with Pyenv + anaconda
Build a python virtual environment with virtualenv and virtualenvwrapper
Build a Python virtual environment using venv (Django + MySQL ①)
Build a Python environment on your Mac using pyenv
Build a Python development environment using pyenv on MacOS
Building a Python virtual environment
Build a Python environment offline
Building a Python virtual environment
Build a Docker environment that can use PyTorch and JupyterLab
Build a Python environment with WSL + Pyenv + Jupyter + VS Code
Build python virtual environment with virtualenv
Create a virtual environment with Python!
Building a virtual environment with Python 3
Build a python3 environment on CentOS7
[Pyenv] Building a python environment with ubuntu 16.04
Build a python environment on MacOS (Catallina)
Let's create a virtual environment for Python
I want to build a Python environment
[Mac] Building a virtual environment for Python
Creating a python virtual environment on Windows
Build a Python + OpenCV environment on Cloud9
Build a modern Python environment with Neovim
Add a Python virtual environment to VSCode
After buying a new Mac, use pyenv + poetry to build a Python environment.
A memo that allows you to change Pineapple's Python environment with pyenv
Ubuntu18.04.05 Creating a python virtual environment in LTS
Build python environment with pyenv on EC2 (ubuntu)
Build a python environment with ansible on centos6
Build a Python environment on Mac (Mountain Lion)
Create a virtual environment with conda in Python
[Python] Build a Django development environment with Docker
Build a Python development environment on your Mac
[Python] Web development preparation (building a virtual environment)
[Venv] Create a python virtual environment on Ubuntu
Build a Python environment with OSX El capitan
Create a Python virtual development environment on Windows
Build a Python machine learning environment with a container
Build a Python development environment on Raspberry Pi
Build a python execution environment with VS Code
[AWS] Development environment version that tried to build a Python environment with eb [Elastic Beanstalk]
Build a GVim-based Python development environment on Windows 10 (3) GVim8.0 & Python3.6
Building a Python environment for pyenv, pyenv-virtualenv, Anaconda (Miniconda)
How to set up a Python environment using pyenv
# 2 Build a Python environment on AWS EC2 instance (ubuntu18.04)
Create a virtual environment with Anaconda installed via Pyenv
Build a machine learning Python environment on Mac OS
Build a GVim-based Python development environment on Windows 10 (1) Installation
How to build a Django (python) environment on docker
From a book that programmers can learn ... (Python): Pointer
Build a Python development environment on Mac OS X
Build a machine learning application development environment with Python
Building and enabling a python virtual environment, etc. (venv)
How to build a Python environment on amazon linux 2
Build a Django environment for Win10 (with virtual space)
Build a numerical calculation environment with pyenv and miniconda3
python virtual environment Pipenv
virtual environment in python