There are a lot of options to isolate your Python environment so you don’t affect all your system packages while just playing around with tutorials online. Feel free to use your own if you have a favorite already, but for those that don’t, keep reading!
We will stick to the simplest and built-in method of using the provided
venv module. This creates a new directory in the folder it has been run in, and becomes a clean and disposable place to install random packages.
Open a terminal and navigate to a directory you are comfortable adding another folder in that you can play around with. Then run the command to create a new virtual env directory
python -m venv <new venv dir> I usually just call mine ‘venv’ because I am so original.
python -m venv venv
Now you need to
activate it. That will replace the calls to
pip and any other executable in that
venv in the current terminal where it’s activated.
If you get an error that you don’t have permissions to run scripts, you may need to allow running scripts.
Then try running
Windows Command Prompt
Now in your terminal the lines should start with
(venv) and you’re free to install whatever crazy packages you want to try out!