5 Replies - 616 Views - Last Post: 17 December 2016 - 01:10 PM

#1 albert003  Icon User is online

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 385
  • Joined: 15-December 14

Trying to use python3 instead of python2 but Ubuntu wont let me use it

Posted 14 December 2016 - 12:15 PM

I've finished learning python2 and wanted to learn python3. I've installed python3 per the Ubuntu website and when I go to terminal and key in python -V it shows I have python2 (which is ok, I still wanted in in my laptop) and when I key in python3 -V it shows I have python3. My question is how do I open notepadqq or IDLE and only use python3?.
Thanks in advance.
Is This A Good Question/Topic? 0
  • +

Replies To: Trying to use python3 instead of python2 but Ubuntu wont let me use it

#2 astonecipher  Icon User is offline

  • Too busy for this
  • member icon

Reputation: 2343
  • View blog
  • Posts: 9,400
  • Joined: 03-December 12

Re: Trying to use python3 instead of python2 but Ubuntu wont let me use it

Posted 14 December 2016 - 12:22 PM

Install IDLE3 for python3. I don't use notepad, so I can't say anything there. It may be you configure the version to use somewhere, PyCharm has that were you can run multiple instances of the same language.
Was This Post Helpful? 1
  • +
  • -

#3 woooee  Icon User is offline

  • D.I.C Head

Reputation: 45
  • View blog
  • Posts: 168
  • Joined: 21-November 12

Re: Trying to use python3 instead of python2 but Ubuntu wont let me use it

Posted 14 December 2016 - 06:21 PM

Generally python points to Python2.x. You have to specifically call Python3.x, i.e. "python3 -V" or #! /usr/bin/python3" for the shebang. A look in the /usr/bin/ directory should make that obvious as there will be a symlink to python2.x. Notepadqq, IDLE, or any text editor will edit any python .py file. If you have a Python3 shebang, then it will use Python3 to run the program instead of Python2. Obviously I can not know how every IDE works, but if it does not work that way for you, just run the program from a terminal, which will use the shebang, and a different version of Python.

This post has been edited by woooee: 14 December 2016 - 06:26 PM

Was This Post Helpful? 1
  • +
  • -

#4 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6564
  • View blog
  • Posts: 30,701
  • Joined: 10-May 07

Re: Trying to use python3 instead of python2 but Ubuntu wont let me use it

Posted 14 December 2016 - 07:07 PM

What woooee suggested is along the lines of what I was going to suggest;
Leave python2 as your default, & install python3 from source to /usr/local/bin/python3, & then add it to your path as binary python3. This when when you call python it is is python2, & when you call python3 it is python3.

You will also want to keep relative paths in mind too, when you install things with pip. For this, I also installed pip under /usr/local/bin/ & keep it relative to python3.

Lastly, this isn't really a python question, has nothing to do with python code or the language. It's a Linux OS question, moving to Computer Support -> Software -> Linux/Unix/OSX
Was This Post Helpful? 1
  • +
  • -

#5 albert003  Icon User is online

  • D.I.C Regular

Reputation: 14
  • View blog
  • Posts: 385
  • Joined: 15-December 14

Re: Trying to use python3 instead of python2 but Ubuntu wont let me use it

Posted 17 December 2016 - 08:47 AM

Thank you for all of your suggestions and advice. I apologise if its isn't a question to put on this forum. I didn't know where else to go to ask my question.
Was This Post Helpful? 0
  • +
  • -

#6 no2pencil  Icon User is offline

  • Professor Snuggly Pants
  • member icon

Reputation: 6564
  • View blog
  • Posts: 30,701
  • Joined: 10-May 07

Re: Trying to use python3 instead of python2 but Ubuntu wont let me use it

Posted 17 December 2016 - 01:10 PM

It's fine on the forum, just not a python coding question. No worries, I moved it to the appropriate place.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1