LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-09-2017, 03:20 AM   #1
bmohanraj91
LQ Newbie
 
Registered: Apr 2017
Posts: 14

Rep: Reputation: Disabled
how to start python3.6 interpreter just by typing python in terminal not python3.6


Hi,

I installed python3.6 recently and now I have 2 different versions of python installed in my linux machine such as
python2.7, python3.6 under the directory /usr/bin.

In terminal if I type 'python', it starts python2.7.12 interpreter. Is there anyway to start python3.6 interpreter instead of 2.7.12 when I type python in terminal.


Linux OS detail:
DISTRIB_ID=Peppermint
DISTRIB_RELEASE=7
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Peppermint 7 Seven"
NAME="Peppermint"
VERSION="Seven"
ID=peppermint
ID_LIKE=debian
PRETTY_NAME="Peppermint Seven"
VERSION_ID="7"

Thanks,
Mohan
 
Old 05-09-2017, 03:43 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,811

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
yes, that can be easily solved.
If you enter:
Code:
 % which python
/usr/bin/python
 % ls -l /usr/bin/python
lrwxrwxrwx 1 root root 9 dec   21  2013 /usr/bin/python -> python2.7
 %
you will see /usr/bin/python is actually a link, so theoretically you need only to modify it to point to python3.6.

BUT I do not suggest you to modify it at all. You must not change it, because (almost) all of your python scripts will die - if you force to run using python3 instead of python2.
 
Old 05-09-2017, 04:25 AM   #3
bmohanraj91
LQ Newbie
 
Registered: Apr 2017
Posts: 14

Original Poster
Rep: Reputation: Disabled
I dont have any python programs in my system, I am starting new, so please let me know to change the link..

Quote:
Originally Posted by pan64 View Post
yes, that can be easily solved.
If you enter:
Code:
 % which python
/usr/bin/python
 % ls -l /usr/bin/python
lrwxrwxrwx 1 root root 9 dec   21  2013 /usr/bin/python -> python2.7
 %
you will see /usr/bin/python is actually a link, so theoretically you need only to modify it to point to python3.6.

BUT I do not suggest you to modify it at all. You must not change it, because (almost) all of your python scripts will die - if you force to run using python3 instead of python2.
 
Old 05-09-2017, 04:47 AM   #4
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,811

Rep: Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306Reputation: 7306
you do have python scripts installed on your system, it is used by a lot of tools (for example rhythmbox).
From the other hand you can make an alias in your ~/.bashrc file:
alias python=/usr/bin/python3.6
and relogin.
 
2 members found this post helpful.
Old 05-10-2017, 07:51 AM   #5
Jjanel
Member
 
Registered: Jun 2016
Distribution: any&all, in VBox; Ol'UnixCLI; NO GUI resources
Posts: 999
Blog Entries: 12

Rep: Reputation: 363Reputation: 363Reputation: 363Reputation: 363
Why not just: (a program name CAN have . - _ like: ln -s /usr/bin/ls My_Own-ls.1)
Code:
% python3.6
? ls -l /usr/bin/py*
Also try: py<tab><tab> (py followed immediately by two tabs: bash command completion)
Here's a page with a pile of info. Says: DoNOT change that link!

Welcome to LQ, and the zillions of little FUN Linux puzzles (like pyenv!)

Last edited by Jjanel; 05-10-2017 at 08:10 AM.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
python3 + gtk3 changos Programming 10 04-25-2017 12:45 PM
After upgrade python3.4 to python3.5.1 , not able to install packages "request" though pip3 YOGESHAS87 Linux - Software 1 08-03-2016 10:38 PM
Packaging Python Libraries for Python3 Jeff91 Debian 0 04-05-2015 06:48 PM
[SOLVED] Python3.2 vs yum hpfeil Fedora 4 08-01-2012 10:51 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:38 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration