UTK007
UTK007

Reputation: 51

How can i remove python 2.7 as i already have 3.6.5 installed on ubuntu?

i have both 2.7 as well as 3.6.5 installed , at first in ubuntu 18.04 the only python version available was 3.6 but after i installed numpy package, along with it 2.7 got installed as well and it turned into default. Is there any solution so as to make 3.6 the default one instead of 2.7??

Upvotes: 4

Views: 18764

Answers (2)

Laetitia
Laetitia

Reputation: 41

I set python 3 version as default using the following commands:

  1. Check python version on terminal - python --version
  2. Get root user privileges. On terminal type - sudo su
  3. If needed write down the root user password.
  4. Execute this command to switch to python 3.6. update-alternatives --install /usr/bin/python python /usr/bin/python3 1
  5. Check python version - python --version
  6. Write exit to exit the root mode

Upvotes: 4

chinmayan
chinmayan

Reputation: 1384

Open .bashrc file nano ~/.bashrc. Type alias python=python3 on to a new line at the top of the file then save and close the file with ctrl+o and ctrl+x.

Upvotes: 18

Related Questions