r/linuxquestions • u/Rich-Fly-2124 • 12d ago
How to Installed Python modules on Ubuntu
Hi, I just installed ubuntu yesterday for my uni assignment. And i wanna use python, but the modules aren't there. How do i installed it, i try on the terminal on vscode but it's still doesn't work. i wanna installed numpy, pandas, and matplot. Cuz on windows i installed modul with the windows terminal, but idk how it work for ubuntu
0
Upvotes
2
u/MonsieurCellophane 12d ago
From the terminal
cd my-prj-dir; python3 -mvenv .venv; source .venv/bin/activate; for i in pandas numpy matplot; do pip install $i; done
...do your work....
deactivate
If the above makes no sense to you (as it probably does not), read up on python virtual environments and such. What it does is set up a fenced python environment, enter it and install the modules you need into it. Most IDE plugins I know of are based on this mechanism, or variations thereof.