Ubuntu This forum is for the discussion of Ubuntu Linux. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
 |
|
03-15-2019, 11:31 AM
|
#1
|
LQ Newbie
Registered: Mar 2019
Posts: 9
Rep: 
|
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'
|
|
|
03-18-2019, 03:07 AM
|
#2
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,365
|
so what is /usr/bin/python3 ?
|
|
|
03-18-2019, 07:23 AM
|
#3
|
LQ Newbie
Registered: Mar 2019
Posts: 9
Original Poster
Rep: 
|
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?
|
|
|
03-18-2019, 07:30 AM
|
#4
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,365
|
Code:
ls -l /usr/bin/python3
which python3
type python3
file /usr/bin/python3
readlink -f /usr/bin/python3
or something similar
|
|
|
03-18-2019, 08:01 AM
|
#5
|
LQ Newbie
Registered: Mar 2019
Posts: 9
Original Poster
Rep: 
|
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.
|
|
|
03-18-2019, 08:06 AM
|
#6
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,365
|
would be nice to post the exact result, not an explanation
|
|
|
03-18-2019, 08:08 AM
|
#7
|
LQ Newbie
Registered: Mar 2019
Posts: 9
Original Poster
Rep: 
|
$ 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
$
|
|
|
03-18-2019, 08:13 AM
|
#8
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,365
|
ok, thanks. The next one is:
/usr/bin/python3.5 --version
|
|
|
03-18-2019, 08:16 AM
|
#9
|
LQ Newbie
Registered: Mar 2019
Posts: 9
Original Poster
Rep: 
|
$ readlink -f /usr/bin/python3
/usr/bin/python3.5
$ /usr/bin/python3.5 --version
Python 2.7.12
$
|
|
|
03-18-2019, 08:24 AM
|
#10
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,365
|
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.
|
|
|
03-18-2019, 08:29 AM
|
#11
|
LQ Newbie
Registered: Mar 2019
Posts: 9
Original Poster
Rep: 
|
$ 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
$
|
|
|
03-18-2019, 08:30 AM
|
#12
|
LQ Newbie
Registered: Mar 2019
Posts: 9
Original Poster
Rep: 
|
It is Ubuntu 16.04, but I can't get the $ lsb_release -a command to work
|
|
|
03-18-2019, 08:32 AM
|
#13
|
LQ Newbie
Registered: Mar 2019
Posts: 9
Original Poster
Rep: 
|
$ 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
$
|
|
|
03-18-2019, 10:05 AM
|
#14
|
LQ Addict
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 24,365
|
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.
|
|
|
03-18-2019, 10:33 AM
|
#15
|
LQ Newbie
Registered: Mar 2019
Posts: 9
Original Poster
Rep: 
|
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.
|
|
|
All times are GMT -5. The time now is 10:24 PM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|