Python should come pre-installed by default on most Linux distros.
However it might not be the version you want to (or should) use.
Check which version of Python you have installed on your system:
python --version
Python 3.6.0
Great, I have Python 3! If you see something like:
python --version
Python 2.7.13
it means that python
points to Python 2. In such case, try this:
python3 --version
Python 3.6.0
If the last command returns an error, then please install Python 3:
sudo apt-get install python3
python3 myscript.py
python myscript.py
Make sure you install a version compatible with Python 3:
sudo apt-get install ipython3 jupyter
jupyter
package yet, try to install the ipython3-notebook
package instead.ipython
A powerful interactive Python shell.
To launch an ipython session from a terminal:
ipython
ipython
is great for doing some experimentation or discover something new about the language.
To exit the session just press Ctrl-D
or close the terminal.
Note: After exit your entire session will be lost!
jupyter notebook
Jupyter
is the evolution of ipython
...eh, like a Pokemon! :-p
jupyter notebook
(or ipython notebook
) server from a terminal:ipython notebook
jupyter notebook
jupyter
right now! :-)sudo apt-get install python3-numpy python3-scipy python3-matplotlib
pip
:sudo apt-get install python3-pip
pip
to install additional modules.Note: When installing things with pip
, never use sudo
! I mean, don't do this:
sudo pip install modulename
or you might risk breaking your system!!!
Instead, you should pip
-install modules locally, which is safe and you won't mess with your system.
For example:
pip3 install --user modulename
will install the modulename
package under ~/.local/lib/python3.X/site-packages
To uninstall it:
pip3 uninstall modulename