Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Need to run Python 3.5

I've installed Python 3.5 for the Mac, it was installed in:

/Applications/Python 3.5

When I open Idle, the shell starts off saying:

Python 3.5.1 (v3.5.1:37a07cee5969, Dec  5 2015, 21:12:44) 

I've created a script and I'm running it through the Python launcher. The script says:

import sys
print (sys.version)

It returns:

2.7.5 (default, Mar  9 2014, 22:15:05)

In the Python launcher preferences there's an option for changing the path to the Python interpreter that I want to use. Right now it's set to:

/usr/bin/pythonw

In /usr/bin, the only versions of python are 2.5, 2.6 and 2.7. Where did my 3.5 go and how can I point my Python launcher to the proper place?

like image 860
Eamonn Gormley Avatar asked Nov 26 '25 22:11

Eamonn Gormley


1 Answers

This is a PATH environment issue. If you want /Applications/Python 3.5 to launch in preference to any other version, you need to edit your shell profile to put /Applications before any other directory.

If this is a foreign concept, then you are better off removing Python 3.5 from your Applications folder and installing the Anaconda 3.x version (currently at 3.4.3, but don't let that worry you).

In no event, however, mess with the pythons in /usr/bin. You'll end up having to reinstall the OS in all likelihood.

If you look at the man page for pythonw you'll see that it can't be changed from 2.7 upward. The Anaconda executable by the same name simply calls the most current Anaconda version.

With your current setup, you could work around the issues with appropriate shell aliases, but I'm guessing that if these were familiar tools you already would have answered your own question. Take a look at Anaconda.com; it's free, well supported and you won't have to worry about these sorts of questions. It will also make installing packages much easier.

like image 84
Richard Careaga Avatar answered Nov 29 '25 11:11

Richard Careaga



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!