-2

This morning i wanted to host my Discord Bot, written on Python on my VPS on Ubuntu 14.04 After couple of minutes f#@$ing with Python repos i realized, that i got several Python versions installed on my VPS.

The main one is Python 2.7.12, that is absolutely old and can't launch Discord Bot, cause it needs pip install Discord, that is supported only with Python 3 and upper. After couple of minutes I installed Python 3.6.3, that i needed. But when I tried to install Discord for Python it didn't install, because it needs, as I've said, Python 3 and upper version. I saw in cmd, that while installing this Discord Plugin for Python cmd tried to execute command python setup.py egg_info, that failed because python runs Python 2.7.12 and to run Python 3.6.3 I've installed i need to write python3.6. So, how can i switch the default (main) version of Python in order to run Python 3.6.3, while executing python.

Thank you for your answers. (My apologize, if I've exploded your brain)

  • The easier solution would be to run python 3 using the command `python3`which is the default behaviour – Imre_G Jan 20 '18 at 11:58

2 Answers2

1

It is not recommended to change default python. You just type 'python3'

$ python3 yourscript.py

Or take a look at this Two versions of python on linux. how to make 2.7 the default

el3ien
  • 5,362
  • 1
  • 17
  • 33
0

Windows To run Python2.x

py -2 script.py

To run Python 3.x

py -3 script.py

On Linux use :-

python3 script.py
aberry
  • 447
  • 3
  • 10