I just updated my ReadyNas from python 2.3.5 to python 2.6.6. The upgrade placed the new version in the /usr/local/bin
directory. So
/usr/local/bin/python
is Python 2.6.6/usr/bin/python
is Python 2.3.5When I type python
at a bash prompt tries to run /usr/bin/python
or my old version. I relocated my old version, and now I get:
bash: /usr/bin/python: No such file or directory
How can I change where bash looks for python? How is bash currently deciding that when I type python
that it only looks in /usr/bin
for python?
Setting Path in Unix or Linux In the csh shell, type the following sentence: PATH “$PATH:/usr/local/bin/python” and press Enter. If you are using the standard flavour of Linux, open up the bash shell and type the following phrase, export PATH=”$PATH:/usr/local/bin/python” and press Enter.
Your PATH
environment variable. It has a list of directories which bash searches (in the same order) when it's looking for an program to execute. Basically you want to put /usr/local/bin
at the start of your PATH
environment variable. Add the following to your ~/.bashrc
file:
export PATH=/usr/local/bin:$PATH
You can have a look at the current setting by running the set
command in bash.
Alternatively, you can simply rename /usr/bin/python
to /usr/bin/python2.3
and create a symlink pointing to the new version, e.g.
ln -s /usr/local/bin/python /usr/bin/python
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With