LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 06-10-2017, 11:07 AM   #1
olcal
LQ Newbie
 
Registered: Jan 2008
Distribution: Slackware 14.2
Posts: 21

Rep: Reputation: 0
Accidentally changed default version of Python in Slackware 14.2


I have Slackware 14.2. I downloaded and installed Anaconda Package from Continuum so that I could follow a Python course which uses the Spyder IDE.
But this version of Python has become the default Python on my system. When I type Python on the command line the shell takes me to the Anaconda version. How do I get back the original default version of Python installed in Slackware 14.2 ?
 
Old 06-10-2017, 11:56 AM   #2
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
What's the output of the command
Code:
type python
On my system, it's
Code:
$ type python
python is /usr/bin/python
You can then see what the command
Code:
file $(type python | cut -d ' ' -f 3-)
gives you as well as
Code:
ls -l $(type python | cut -d ' ' -f 3-)
.

On my system, the first gives
Code:
$ file $(type python | cut -d ' ' -f 3-)
/usr/bin/python: symbolic link to python2.7
and the second gives
Code:
$ ls -l $(type python | cut -d ' ' -f 3-)
lrwxrwxrwx 1 root root 9 Jan 14 19:17 /usr/bin/python -> python2.7*

EDIT: God knows what the Anaconda installer did to your system. I'm not going to install it on mine to find out.

Last edited by Richard Cranium; 06-10-2017 at 12:00 PM. Reason: Looked up Anaconda.
 
Old 06-10-2017, 12:32 PM   #3
olcal
LQ Newbie
 
Registered: Jan 2008
Distribution: Slackware 14.2
Posts: 21

Original Poster
Rep: Reputation: 0
Hello Richard,

Thank you for your reply.

When I enter
Code:
type python
I get
Code:
python is root anaconda3/bin/python
When I enter
Code:
file $(type python | cut -d '' -f 3-)
I get
Code:
hashed:                       cannot open `hashed' (No such file or directory)
(/root/anaconda3/bin/python): cannot open `(/root/anaconda3/bin/python)' (No such file or directory)

When I enter
Code:
ls -l file $(type python | cut -d '' -f 3-)
I get
Code:
ls: cannot access 'hashed': No such file or directory
ls: cannot access '(/root/anaconda3/bin/python)': No such file or directory
Ideally I think I should get the same result as yours.
What do I have to do to get back to the default Python 2.7 that comes with Slackware ?
 
Old 06-10-2017, 12:53 PM   #4
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
You should see a .bashrc-anaconda2.bak file in your home directory. Copy that into ~/.bashrc, log out, and log back in.

In fact, the Anaconda installer should have asked you a bunch of questions that I assume you didn't pay much attention to as well as telling you that it made that backup file.
 
Old 06-10-2017, 12:55 PM   #5
TommyC7
Member
 
Registered: Mar 2012
Distribution: Slackware, CentOS, OpenBSD, FreeBSD
Posts: 530

Rep: Reputation: Disabled
Seems like that changed quite a few things on your system (if it wasn't there already).

e.g.: "$HOME"/bin being first in the user's $PATH.

Can we see the output of:
Code:
file /usr/bin/python
 
Old 06-10-2017, 09:05 PM   #6
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
@olcal, I've had a (insert your favorite phrase for a bad day here) day. You may very well feel that I have been living up to my screen name in my replies; if that's the case, please accept my apologies.

From what I saw in the Anaconda installer, it should have...
  1. Installed itself only for the user that you were logged in with when you installed it.
  2. Provided backups for any important files that it modified.

Those two things are great, actually. I believe that if you copy the backup file that I had mentioned earlier to your ~/.bashrc file and re-login, that your normal user will be using the Slackware default Python.
 
Old 06-11-2017, 01:59 AM   #7
olcal
LQ Newbie
 
Registered: Jan 2008
Distribution: Slackware 14.2
Posts: 21

Original Poster
Rep: Reputation: 0
Solved

@Richard Cranium.
Yes, you are right. After you mentioned it I recalled that during installation the Anaconda installer asked if I wanted it to be the default Python installation. I entered yes
and hit enter. Wasn't paying close attention. I did as you said and edited the .bashrc file. The default Python is now set to version 2.7 . Thank you.

When I enter
Code:
type python
Now I get
Code:
python is /usr/bin/python
When I enter
Code:
python -V
Now I get
Code:
Python 2.7.11
I now recall that the Anaconda Windows installer had also asked if I wanted to set it to be the default Python installer. I entered No.
Once again thank you. I have learned a bit more about the Linux O/S.

I also observed that the default Python path was changed only in the KDE Desktop environment console application Terminal Emulator / Terminal / UXTerm / Xterm.
If I executed
Code:
type python
before running
Code:
startx
it showed me python 2.7.
But if I ran
Code:
type python
in the KDE console I got the Anaconda Python. Just thought you should know.

@TommyC7
When I enter
Code:
file /usr/bin/python
I get
Code:
/usr/bin/python: symbolic link to python2.7
The problem is now solved. Thank you TommyC7.
 
Old 06-11-2017, 02:18 PM   #8
Richard Cranium
Senior Member
 
Registered: Apr 2009
Location: McKinney, Texas
Distribution: Slackware64 15.0
Posts: 3,858

Rep: Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225Reputation: 2225
I didn't check that closely in the Anaconda installer, but it might also add something to the KDE startup files for your user to make it the default for that environment as well. I don't use KDE that much, so I won't be much help for fixing that.
 
  


Reply

Tags
anaconda, python ide, slackware 14.2



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] Slackware Current and Slackware 14.2 default kernel version? LinuxUser42 Slackware 1 02-10-2016 11:39 PM
Change default Python version rocka Debian 13 03-31-2009 05:26 PM
LXer: change of the default python version (status) LXer Syndicated Linux News 0 08-08-2006 02:33 PM
Accidentally changed the permissions of /proc/, help restoring them please Th3James Linux - General 5 01-24-2006 03:24 AM
changed root's shell accidentally frankie_DJ Linux - Newbie 7 09-19-2004 11:28 PM

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

All times are GMT -5. The time now is 12:16 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