[SOLVED] Accidentally changed default version of Python in Slackware 14.2
SlackwareThis Forum is for the discussion of Slackware 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.
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.
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 ?
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 ?
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.
@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...
Installed itself only for the user that you were logged in with when you installed it.
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.
@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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.