I'm using the MySQL Workbench to run MySQL 5.7 and I have Python installed.
Asked
Active
Viewed 3.8k times
1
-
@AkhilVarma That only show python 2 on Ubuntu. – Jacob Vlijm Mar 12 '17 at 16:53
-
1@AkhilVarma because Ubuntu uses multiple versions. python refers to python2, python3 to python3. – Jacob Vlijm Mar 12 '17 at 16:59
-
....but that only shows the version of 3. – Jacob Vlijm Mar 12 '17 at 17:03
-
he asked question for python3 , that's why..@JacobVlijm. anyway your answer was optimum. – Akhil Varma Mar 12 '17 at 17:06
-
Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/55221/discussion-between-akhil-varma-and-jacob-vlijm). – Akhil Varma Mar 12 '17 at 17:09
2 Answers
3
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
wjandrea
- 14,109
- 4
- 48
- 98
George Udosen
- 35,970
- 13
- 99
- 121
0
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.
impalle
- 77
- 1
- 1
- 12
-
2If you mean switch between 2 and 3, this is an extremely bad idea. Please clarify. – Jacob Vlijm Mar 12 '17 at 17:54