MacOS – Removing current Python version and using another Python version

macosmacportspythonterminal

First of all I installed python 2.7 with manual. After I installed Python 2.6 with Macports with referenced this.

And after that I deleted my Python 2.7 files.

The main point is when I type python at terminal get this:

-bash: /Library/Frameworks/Python.framework/Versions/2.7/bin/python: No such file or directory

But if I type the command python2.6 the Python works with all components (like PyQt).

So how can I activate python command?

Best Answer

I think you probably have two options, barring a reinstallation of 2.7, which might be the easiest thing to do.

You can include the following first line in every Python script:

#!/usr/local/bin/python2.6

Change the path to reflect the version and location of the Python you would like to use.

Alternately you could create a bash alias like:

alias python = '/path/to/pythonversion'

I would go with the first version myself.