LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu
User Name
Password
Ubuntu This forum is for the discussion of Ubuntu Linux.

Notices


Reply
  Search this Thread
Old 03-15-2019, 11:31 AM   #1
gene_
LQ Newbie
 
Registered: Mar 2019
Posts: 9

Rep: Reputation: Disabled
python3 -V returns Python 2.7.12, can't get python3 to work.


I have been writing some code in Python3 using tkinter for graphics, and also python2 to upload to trinket.io. I am not sure what caused the python3 install to break, but now I can't get any code to find it,
typing $python3 -V returns Python 2.7.12.
Typing $which python3 returns /usr/bin/python3.
I have tried uninstalling, reinstalling, upgrading, installing pip, everything I can find online. I think I trashed to original python3 install and the links and path. Not sure where to start to figure out how to get a working install.

I have gotten as far as finding one PPA I can't uninstall, not sure if it's related.

$ sudo apt-add-repository --remove ppa:bhdouglass/indicator-remindor

returns:

File "/usr/bin/lsb_release", line 64
print("No LSB modules are available.", file=sys.stderr)
^
SyntaxError: invalid syntax
Traceback (most recent call last):
File "/usr/bin/apt-add-repository", line 22, in <module>
sys.stdout.detach(), encoding="UTF-8", line_buffering=True)
AttributeError: 'file' object has no attribute 'detach'
 
Old 03-18-2019, 03:07 AM   #2
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,818

Rep: Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873
so what is /usr/bin/python3 ?
 
Old 03-18-2019, 07:23 AM   #3
gene_
LQ Newbie
 
Registered: Mar 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
when I go to the /usr/bin directory and type python3 -V I get Python 2.7.12. How can I actually check the file python3 to see what binary it is?
 
Old 03-18-2019, 07:30 AM   #4
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,818

Rep: Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873
Code:
ls -l /usr/bin/python3
which python3
type python3
file /usr/bin/python3
readlink -f /usr/bin/python3
or something similar
 
Old 03-18-2019, 08:01 AM   #5
gene_
LQ Newbie
 
Registered: Mar 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
they all say python3.5

whenever I run any python or python3 command, python 2.7.12 is always used. I can't seem to access python3 or any other version.
 
Old 03-18-2019, 08:06 AM   #6
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,818

Rep: Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873
would be nice to post the exact result, not an explanation
 
Old 03-18-2019, 08:08 AM   #7
gene_
LQ Newbie
 
Registered: Mar 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
$ python3 -V
Python 2.7.12
$ ls -l /usr/bin/python3
lrwxrwxrwx 1 root root 9 Mar 23 2016 /usr/bin/python3 -> python3.5
$ which python3

/usr/bin/python3
$
$ type python3
python3 is hashed (/usr/bin/python3)
$ type python3
python3 is hashed (/usr/bin/python3)
$ readlink -f /usr/bin/python3
/usr/bin/python3.5
$
 
Old 03-18-2019, 08:13 AM   #8
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,818

Rep: Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873
ok, thanks. The next one is:
/usr/bin/python3.5 --version
 
Old 03-18-2019, 08:16 AM   #9
gene_
LQ Newbie
 
Registered: Mar 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
$ readlink -f /usr/bin/python3
/usr/bin/python3.5
$ /usr/bin/python3.5 --version
Python 2.7.12
$
 
Old 03-18-2019, 08:24 AM   #10
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,818

Rep: Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873
What OS is it? Which python versions are installed ?
also what will say: ls -l /usr/bin/python*

Last edited by pan64; 03-18-2019 at 08:26 AM.
 
Old 03-18-2019, 08:29 AM   #11
gene_
LQ Newbie
 
Registered: Mar 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
$ lsb_release -a
File "/usr/bin/lsb_release", line 64
print("No LSB modules are available.", file=sys.stderr)
^
SyntaxError: invalid syntax
$


$ ls python*
python python2-config python3.5m python-config
python2 python2-dbg python3.5m-config python-dbg
python2.7 python2-dbg-config python3-config python-dbg-config
python2.7-config python3 python3m
python2.7-dbg python3.5 python3m-config
python2.7-dbg-config python3.5-config python-argcomplete-check-easy-install-script3
$
 
Old 03-18-2019, 08:30 AM   #12
gene_
LQ Newbie
 
Registered: Mar 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
It is Ubuntu 16.04, but I can't get the $ lsb_release -a command to work
 
Old 03-18-2019, 08:32 AM   #13
gene_
LQ Newbie
 
Registered: Mar 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
$ ls -l /usr/bin/python*
lrwxrwxrwx 1 root root 9 Nov 23 2017 /usr/bin/python -> python2.7
lrwxrwxrwx 1 root root 9 Nov 23 2017 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 3829036 Nov 23 2017 /usr/bin/python2.7
lrwxrwxrwx 1 root root 31 Nov 23 2017 /usr/bin/python2.7-config -> i386-linux-gnu-python2.7-config
-rwxr-xr-x 1 root root 5830736 Nov 23 2017 /usr/bin/python2.7-dbg
lrwxrwxrwx 1 root root 35 Nov 23 2017 /usr/bin/python2.7-dbg-config -> i386-linux-gnu-python2.7-dbg-config
lrwxrwxrwx 1 root root 16 Nov 23 2017 /usr/bin/python2-config -> python2.7-config
lrwxrwxrwx 1 root root 13 Nov 23 2017 /usr/bin/python2-dbg -> python2.7-dbg
lrwxrwxrwx 1 root root 20 Nov 23 2017 /usr/bin/python2-dbg-config -> python2.7-dbg-config
lrwxrwxrwx 1 root root 9 Mar 23 2016 /usr/bin/python3 -> python3.5
-rwxr-xr-x 2 root root 3829036 Feb 17 13:53 /usr/bin/python3.5
lrwxrwxrwx 1 root root 31 Nov 12 09:26 /usr/bin/python3.5-config -> i386-linux-gnu-python3.5-config
-rwxr-xr-x 2 root root 3829036 Feb 17 13:53 /usr/bin/python3.5m
lrwxrwxrwx 1 root root 32 Nov 12 09:26 /usr/bin/python3.5m-config -> i386-linux-gnu-python3.5m-config
lrwxrwxrwx 1 root root 16 Mar 23 2016 /usr/bin/python3-config -> python3.5-config
lrwxrwxrwx 1 root root 10 Mar 23 2016 /usr/bin/python3m -> python3.5m
lrwxrwxrwx 1 root root 17 Mar 23 2016 /usr/bin/python3m-config -> python3.5m-config
-rwxr-xr-x 1 root root 2553 Feb 10 2016 /usr/bin/python-argcomplete-check-easy-install-script3
lrwxrwxrwx 1 root root 16 Nov 23 2017 /usr/bin/python-config -> python2.7-config
lrwxrwxrwx 1 root root 13 Nov 23 2017 /usr/bin/python-dbg -> python2.7-dbg
lrwxrwxrwx 1 root root 20 Nov 23 2017 /usr/bin/python-dbg-config -> python2.7-dbg-config
$
 
Old 03-18-2019, 10:05 AM   #14
pan64
LQ Guru
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 14,818

Rep: Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873Reputation: 4873
interesting, your python3 and python2 binaries are the same.
You can check it by:
Code:
md5sum /usr/bin/python2.7 /usr/bin/python3.5
# also what will say:
dpkg -l | grep 'python.*default'
lsb_release is a python3 script, probably that is a problem now.
I would [try to] force reinstall python3.
 
Old 03-18-2019, 10:33 AM   #15
gene_
LQ Newbie
 
Registered: Mar 2019
Posts: 9

Original Poster
Rep: Reputation: Disabled
ok, thanks. That is what I thought, but I didn't know how to find out for sure. I also don't know how to fix it, everything seems to be pretty hosed.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] making python3.6.4 default python3 Astral Axiom Linux - Newbie 17 04-14-2018 10:55 AM
[SOLVED] how to start python3.6 interpreter just by typing python in terminal not python3.6 bmohanraj91 Linux - Newbie 4 05-10-2017 07:51 AM
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
LXer: Python Python Python (aka Python 3) LXer Syndicated Linux News 0 08-05-2009 08:30 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Ubuntu

All times are GMT -5. The time now is 09:52 PM.

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