3

I had Ubuntu 16.04 LTS for a long time because I was thinking to use Kail Linux, but I never got to installing it so I just got Ubuntu 18.04 LTS. Now I want to know if its safe to remove python2 because now I have python 3.6 and I when I code in python its still uses python2. And if it's not safe to remove python2 then is there a way to just make Visual Studio Code use python3.

  • The linked answer is the wrong way to use python3 in VS Code. For configuring VS Code's python environment, see code.visualstudio.com/docs/python/environments and configure the interpreter to be /usr/bin/python3. As I understand, it should use python3 by default anyway, though. – dobey Sep 27 '18 at 20:39
  • @dobey the last line of the linked answer points to the same link as you for configure VSCode's configuration. I am not a python expert. You may want to expand the comment to answer the question. – user68186 Sep 27 '18 at 20:49
  • I only got python2 when I installed a couple of non-standard apps from repository that still required python2. Default install does not install python2, but other apps may need it. – oldfred Sep 27 '18 at 22:15
4

See for yourself safely using apt's --simulate flag:

$ apt remove python --simulate

Read the proposed removals very carefully for applications and components that you don't want to remove.

If it turns out, after removing Py2, that you needed it after all...then it's trivial to reinstall.

WARNING: This answer applies only to Ubuntu 18.04 and newer. Earlier releases of Ubuntu have key components that depend upon Py2 (like apt). You may be very, very sorry if you remove Py2 in earlier releases of Ubuntu.

  • thank you for helping me, ill make sure to remember this. – TECHSCHOOL200 000 Sep 28 '18 at 23:54
  • Also how can I know that its not removing python 3 and only python 2 – TECHSCHOOL200 000 Sep 28 '18 at 23:58
  • by the way it didnt work. Still have it. – TECHSCHOOL200 000 Sep 29 '18 at 0:01
  • @TECHSCHOOL200000 Perhaps you need to refresh your understanding of the term 'simulate' – user535733 Sep 29 '18 at 14:42
  • I know what 'simulate' means when I removed 'simulate' and just do apt remove python, It says it deleted python but then i go into the command line, i type 'python' and it come up with " Python 2.7.15rc1..." and then the python command line, then when i type python3 its shows up with this "Python 3.6.6...". And in Visual Studio Code it stills shows up with python2. – TECHSCHOOL200 000 Oct 3 '18 at 21:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.