Learn Python with AWS - Day 2

王林
Release: 2024-08-12 18:46:43
Original
738 people have browsed it

Virtual Environments

Today we will learn about virtual environments. A virtual environment in python is a container in which all your code and other python packages reside. It allows you to keep your python configuration separate from other versions on your system. It is a good idea to always use a virtual environment when developing python code.

To create a virtual environment we will use the command:

python -m venv my_venv

Copy after login

Once the virtual environment has been created, you need to activate it. Once activated, your code runs inside the environment, including any packages you install. To activate the environment use one of the following commands:

Linus/mac OS:

source my_venv/bin/activate

Copy after login

Windows (Git-Bash):

source my_venv/Scripts/activate
Copy after login

To know you are inside the virtual environment your command prompt will have the prefix (my_venv). Now any packages you use will be stored in a folder structure inside your virtual environment.

To exit from the virtual environment, you type deactivate and the command prompt will no longer be prefixed by (my_venv).

Learn Python with AWS - Day 2

The above is the detailed content of Learn Python with AWS - Day 2. For more information, please follow other related articles on the PHP Chinese website!

source:dev.to
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!