Python: Creating a virtual environment (venv), starting and stopping

usage environment

macOS Catalina

table of contents

-Create a python virtual environment using ** venv **

-Execute 〇〇.py file in virtual environment

Create a python virtual environment

=== Create virtual environment myPython, start / stop virtual environment ===

-Move to the directory where you want to create a Python virtual environment

cd /Users/tanaka/Downloads/

・ Create a virtual environment

python3.8 -m venv myPython

[Supplement] The virtual environment myPython is under / Users / tanaka / Downloads /.

・ Move to virtual environment

cd myPython

・ Start virtual environment

source bin/activate

・ Install the package

pip install requests

[Supplement] pip install [package name]

-Check the list of installed packages

pip freeze

-Display detailed information for each installed package

pip show requests

・ Close the virtual environment

deactivate

Run .py files in virtual environment

-Drag and drop the .py file you want to execute on the terminal and execute it.

python3.8 /Users/tanaka/Downloads/myPython/main.py 

[Supplement] After entering python3.8 in the terminal, ** drag and drop the main.py file into the terminal **

[End] </ font>

Recommended Posts

Python: Creating a virtual environment (venv), starting and stopping
Building and enabling a python virtual environment, etc. (venv)
Creating a python virtual environment on Windows
Ubuntu18.04.05 Creating a python virtual environment in LTS
Build a virtual environment with pyenv and venv
[Venv] Create a python virtual environment on Ubuntu
Procedure for creating a Python quarantine environment (venv environment)
Building a Python virtual environment
venv: Python virtual environment management
python standard virtual environment venv
Building a Python virtual environment
Build a python virtual environment with virtualenv and virtualenvwrapper
Build a Python virtual environment using venv (Django + MySQL ①)
Build a python virtual environment with virtualenv and virtualenvwrapper
Create a virtual environment with Python!
Building a virtual environment with Python 3
Python virtual environment and packages on Ubuntu
Let's create a virtual environment for Python
[Python] Create a virtual environment with Anaconda
[Mac] Building a virtual environment for Python
Build a python virtual environment with pyenv
Creating a virtual environment in an Anaconda environment
Add a Python virtual environment to VSCode
After creating and applying a virtual environment of python3.8.0, code completion did not work with vscode
Prepare a Python virtual environment for your project with venv with VS Code
How about creating a virtual environment with Anaconda and doing pip install?
I was addicted to creating a Python venv environment with VS Code
Migration from Python2 to Python3 (Python2 is rebuilt as a virtual environment and coexists)
Python virtual environment construction (2017 version) pyenv and pyenv-virtualenv and virtualenv and virtualenv wrapper and pyvenv and venv
Building a python environment with virtualenv and direnv
ffmpeg-Build a python environment and split the video
Create a virtual environment with conda in Python
[Python] Web development preparation (building a virtual environment)
Build a simple Python virtual environment without pyenv
A memo when creating a python environment with miniconda
Commands for creating a python3 environment with virtualenv
Work in a virtual environment with Python virtualenv.
Flow of creating a virtual environment with Anaconda
Use jupyter-lab installed in python virtual environment (venv)
A memo for creating a python environment by a beginner
Create a Python virtual development environment on Windows
python virtual environment Pipenv
virtual environment in python
Create a Python environment
Python3, venv and Ansible
Virtual environment with Python 3.6
Create a Django project and application in a Python virtual environment and start the server
A memo to create a virtual environment (venv) before Django
Try creating a compressed file using Python and zlib
Building a Docker working environment for R and Python
Notes on creating a python development environment on macOS Catalina
python package dependencies and virtual environment management tool Poetry
Create a decent shell and python environment on Windows
Notes on creating a virtual environment with Anaconda Navigator
Setting up Jupyter Lab in a Python 3.9 venv environment
Python environment construction and TensorFlow
Build a Python environment offline
python with pyenv and venv
python3.8 venv environment jupyter notebook
How to build a new python virtual environment on Ubuntu
Building a Python environment on a Mac and using Jupyter lab