Create a virtual environment for python on mac [Very easy]

I will post a memo of the procedure of the virtual environment of python on mac.

Required environment

■ Homebrew A tool to install what you need.

■ pyenv A tool for easily switching between Python versions.

■ venv Python standard virtual environment tool

How to create a virtual environment

Create a folder. The name can be anything, so this time I will use "python" for easy understanding.

cd /Users/※username/python

Move to the folder created above and enter the following. Anything is ok because the place of "pyenv" is arbitrary. Since it is a virtual environment, set it to "pyenv". By the way, this is a virtual environment

python -m venv pyenv

If you enter the above, a "pyenv" folder will be created, so enter the folder.

cd /Users/※username/python/pyenv

In the "pyenv" folder

. bin/activate

When you enter

(pyenv)Somehow:pyenv * User name$ 

This is the so-called virtual environment. Even if you install various things here, there is no effect on the main unit. By the way

. bin/activate

If it doesn't work even if you enter

curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py

After trying this

. bin/activate

Please try.

When disabling the virtual environment

deactivate

This will come out.

Recommended Posts

Create a virtual environment for python on mac [Very easy]
Create a Python environment on Mac (2017/4)
Create a python environment on your Mac
[Mac] Building a virtual environment for Python
[Venv] Create a python virtual environment on Ubuntu
Create a Python virtual development environment on Windows
Create a virtual environment with Python!
Create a python environment on centos
Create a Python (pyenv / virtualenv) development environment on Mac (Homebrew)
[Python] Create a virtual environment with Anaconda
Creating a python virtual environment on Windows
Create a Python environment for professionals in VS Code on Windows
Create a Python environment
How to create a Python virtual environment (venv)
Create a virtual environment with conda in Python
Build a Python development environment on your Mac
Create a Python execution environment on IBM i
Things to watch out for when creating a Python environment on a Mac
Steps to create a Python virtual environment with VS Code on Windows
Create a Python3 environment with pyenv on Mac and display a NetworkX graph
Python environment construction For Mac
Building a Python virtual environment
Building a Python virtual environment
Build a local development environment for Laravel6.X on Mac
Build a machine learning Python environment on Mac OS
Create a comfortable Python 3 (Anaconda) development environment on windows
Build a Python development environment on Mac OS X
Build a Python environment on your Mac using pyenv
Building a Python environment for programming beginners (Mac OS)
Create a decent shell and python environment on Windows
Create a Python development environment on OS X Lion
How to build a new python virtual environment on Ubuntu
Building a Python environment on Ubuntu
Python environment construction memo on Mac
Building a virtual environment with Python 3
[Python] Building a virtual python environment for the pyramid tutorial (summary)
Create a Linux environment on Windows 10
Build a python data analysis environment on Mac (El Capitan)
Build a Python extension for E-Cell 4 on Mac OSX (Yosemite)
Create a Python script for Wake on LAN (NAT traversal Wake on LAN [5])
Python3 TensorFlow for Mac environment construction
Build a python environment on CentOS 7.7 for your home server
Create a Python execution environment for Windows with VScode + Remote WSL
Try using virtualenv, which can build a virtual environment for Python
[Mac] Create a Python3 execution environment from the fully initialized state
Create a USB boot Ubuntu with a Python environment for data analysis
Python virtual environment and packages on Ubuntu
Creating amateur python environment settings (for MAC)
[Python] Create a Batch environment using AWS-CDK
Create a virtual environment with Python_Mac version
I installed Kivy on a Mac environment
Build Python environment with Anaconda on Mac
Create an OpenCV3 + python3 environment on OSX
Create a Linux virtual machine on Windows
Build a python virtual environment with pyenv
Build a Python + OpenCV environment on Cloud9
Building a Python development environment for AI development
Add a Python virtual environment to VSCode
python on mac
Prepare a Python virtual environment for your project with venv with VS Code
Create a Python development environment locally at the fastest speed (for beginners)