Difference between revisions of "Set up a Python virtual environment"
Jump to navigation
Jump to search
Line 15: | Line 15: | ||
You will see the prompt change to something like this: | You will see the prompt change to something like this: | ||
<syntaxhighlight lang="bash" | <syntaxhighlight lang="bash"> | ||
(venv)Username@Computer myfolder % | (venv)Username@Computer myfolder % | ||
</syntaxhighlight> | </syntaxhighlight> |
Revision as of 21:48, 2 November 2021
Python virtual environments run their own site directories, allowing them to be optionally separated from system directories. This can easily avoid a potential nightmare of version conflicts - one piece of software on your system may require a certain version to run, while another make require a different one.
Create
venv
is a tool that can be used to create an environment:
python3 -m venv venv
Activate
source venv/bin/activate
You will see the prompt change to something like this:
(venv)Username@Computer myfolder %
Close
Simply type
exit