reordered and renamed for wikidocs

This commit is contained in:
2024-08-10 00:18:30 -05:00
parent 8b47549ff7
commit 1466447ccc
19 changed files with 0 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
To create a virtual environment, go to your projects directory and run the following command. This will create a new virtual environment in a local folder named .venv:
```bash
python3 -m venv .venv
```
The second argument is the location to create the virtual environment. Generally, you can just create this in your project and call it .venv.
venv will create a virtual Python installation in the .venv folder.
Note: You should exclude your virtual environment directory from your version control system using .gitignore or similar.
Activate a virtual environment
Before you can start installing or using packages in your virtual environment youll need to activate it. Activating a virtual environment will put the virtual environment-specific python and pip executables into your shells PATH.
```bash
source .venv/bin/activate
```
To confirm the virtual environment is activated, check the location of your Python interpreter:
```bash
which python
```
While the virtual environment is active, the above command will output a filepath that includes the .venv directory, by ending with the following:
'.venv/bin/python'
While a virtual environment is activated, pip will install packages into that specific environment. This enables you to import and use packages in your Python application.
Deactivate a virtual environment
If you want to switch projects or leave your virtual environment, deactivate the environment:
```bash
deactivate
```