@
JohnRLaw
It is recommended to create a VENV, a Virtual Environment, when using Python. The professionals here make a new VENV for every project they get, I believe. The reason is, some modules have functions or classes of the same name, or different versions of the same module, which may interfere with each other.
Here is a link to how to make a
VENV from realpython, a very good reference webpage.
Basically do this:
You have Python installed on your Linux Mint machine.
Make a folder to hold your VENV, or VENVs, (you can have as many as you like), call it whatever you like: My_Pythons perhaps? In bash, cd to that folder:
Quote:cd My_Pythons
Use this command in a bash terminal to create your virtual environment called GPE. (any name will do). This will install Python in a closed environment.
Quote:python3 -m venv --system-site-packages GPE
Now just type:
Quote:source GPE/bin/activate
And to start Idle:
Quote:python3 -m idlelib.idle
After that, whenever you want to start Python in your virtual environment, run this command in bash. (When you open bash, you will first be in your home folder)
Quote:cd My_Pythons && source GPE/bin/activate && python -m idlelib.idle
I had fun recently, because I could not start Idle. After a while I discovered Idle was not installed with my Python3.12, had to install it first.
Once you have your VENV up and running, you have all the Python builtins already there.
If you have run
Quote:source GPE/bin/activate
you will see the bash command line like this:
Quote:(GPE) pedro@pedro-MSI:~/My_Pythons$
From the above, install other Python modules you want like this:
Quote:(GPE) pedro@pedro-MSI:~/My_Pythons$ pip install module-name
The module will only be installed in your VENV, not system wide.
And when you are finished, don't forget to deactivate:
Quote:(GPE) pedro@pedro-MSI:~/My_Pythons$deactivate
to close your session.
You can also install different versions of Python in different VENVs.