TomSjogren
TomSjogren

Reputation: 789

Change incorrect python path ubuntu

Did a messed up Anaconda installation from inside virtualenv and then tried to clean out for an Anaconda install outside of virtualenv. Deleted Anaconda according to instructions which left me with a bad path to python:

tom@tom-ubuntu:~$ python
bash: /home/tom/anaconda/bin/python: No such file or directory

The Ubuntu 14.04 default Python installation can be reached:

tom@tom-ubuntu:~$ which python2.7
/usr/bin/python2.7

How can I reassign the python2.7 to default python?

I tried to remove (and unlink)

tom@tom-ubuntu:~$ rm /home/tom/anaconda/bin/python
rm: cannot remove ‘/home/tom/anaconda/bin/python’: No such file or directory

and setting the new link

tom@tom-ubuntu:~$ sudo ln -s /usr/bin/python2.7 /usr/bin/python
ln: failed to create symbolic link ‘/usr/bin/python’: File exists

stuck - any help appreciated.

Upvotes: 1

Views: 3906

Answers (1)

Martijn Pieters
Martijn Pieters

Reputation: 1122122

Your shell caches path lookups, and the expansion from python to /home/tom/anaconda/bin/python is still cached.

Simply clear python from that cache:

hash -d python

Once cleared, bash will scan your PATH again to find /usr/bin/python.

Upvotes: 4

Related Questions