Connecting Terminal to Python 3.5

Cameron Simpson cs at zip.com.au
Sun Aug 30 00:05:27 CEST 2015


On 28Aug2015 23:52, Sam Miller <qaz_468 at hotmail.com> wrote:
>I tried to update Python in terminal on my Mac book pro to v3.5 using this website:
> https://wolfpaulus.com/journal/mac/installing_python_osx/

Let me start by saying that this page is a bad idea. If you really know what 
you're doing I suppose it provides useful instructions, but in general, on ANY 
system, replacing the system Python is not something you should do without a 
really good reason. However, even were it a good idea this page does tells you 
to delete the old Python instead of backing it up. Bad.

Leave the system utilities alone.

You can always install stuff outside the system tree.

This is because the OS itself has been built and testing with the system 
supplied python and _may_ have trouble with another version. As it happens 
upgrading Python 2 to a later Python 2 version is mostly safe, but replacing it 
with Python 3 is going to cause a lot of trouble.

Generally, the best thing to do is to install a newer Python (2 or 3 or both) 
_outside_ the vendor's area. You can fetch the source and build it, then 
install somewhere like /usr/local. Alternatively you can install third party 
package systems (for Mac OSX: Fink, MacPorts, HomeBrew - I mostly use MacPorts 
myself) and use them to install newer Pythons. They have their own install 
trees and will install there, away from the main system.

>Sadly
> I must have made a large mistake since after completing these steps
>python IDLE and python within terminal failed to open or run.
>I
>reinstalled python v3.5 again and now IDLE works. On the other hand, when
> I try to open python inside of terminal I get this error message:
>"-bash: python: command not found".

Have you tried "python3"? Plain "python" still means Python 2 these days, 
because they are not compatible.

>I am not sure what to do to correct this error. Could anyone send me the 
>correct code to link my terminal to python 3.5 so I can run python v3.5 within 
>terminal?

I would be more worried about restoring your system's Python 2 first. Very 
important. Do you have backups of your system? Time Machine is a standard part 
of OSX, is incredibly easy to set up and generally great. Are you using it?

Cheers,
Cameron Simpson <cs at zip.com.au>

186,282 miles per second - Not just a good idea, It's the Law!


More information about the Python-list mailing list