I'm using the MySQL Workbench to run MySQL 5.7 and I have Python installed.

  • @AkhilVarma That only show python 2 on Ubuntu. Commented Mar 12, 2017 at 16:53
  • 1
    @AkhilVarma because Ubuntu uses multiple versions. python refers to python2, python3 to python3. Commented Mar 12, 2017 at 16:59
  • ....but that only shows the version of 3. Commented Mar 12, 2017 at 17:03
  • he asked question for python3 , that's why..@JacobVlijm. anyway your answer was optimum. Commented Mar 12, 2017 at 17:06
  • Let us continue this discussion in chat. Commented Mar 12, 2017 at 17:09

2 Answers 2


Run the following commands and whichever gives an output is the version you have:

  • Python 2: python --version
  • Python 3: python3 --version

Note: You can have both installed and used independently by simply adding the shebang to the top of the Python script to indicate which you want to use. Example:

python 2 script: #!/usr/bin/python
python 3 script: #!/usr/bin/python3

I am on Babun (Cygwin fork) and when I type python --version it displays the version.

$ python --version
Python 2.7.8

On a sidenote:

if you have different versions of Python installed, you can switch between them using a shell alias (add to your .bashrc) for example:

alias python=/usr/local/bin/python2.7

Please do use this carefully, as it might break things. Switching between 2.6 and 2.7 should normally work.

  • 2
    If you mean switch between 2 and 3, this is an extremely bad idea. Please clarify. Commented Mar 12, 2017 at 17:54

Not the answer you're looking for? Browse other questions tagged .