Become a MacRumors Supporter for $25/year with no ads, private forums, and more!

Mac Easy to code Python on Mac?

Mr West

macrumors member
Original poster
Apr 9, 2012
59
6
I'm looking to buy a MbAir.
From time to time I code some Python which goes flawless on my current Windows machine.
So quick question, is it as easy on a Mac or does it require a lot of workarounds?
It's just basic coding, nothing professional.
 

Baumi

macrumors regular
Mar 31, 2005
213
281
Most likely, you'll be fine. Python was originally developed for Unix-like platforms, so it's arguably more 'at home' on OS X than on Windows.

OS X 10.10 comes with Python 2.7 pre-installed. If your scripts are plain standard python (i.e. you're not going out of you way to access DLLs or other Windows-only features), they should run only either as-is or with only minimal changes. (E.g., if your scripts are reading/writing from files, you will probably need to tweak their path names.)

You can find more information over at python.org. Their text talks about OS X 10.8, but AFAIK the info should be current for 10.10, as well. Also note the version-switcher in the top-left corner of the page, in case you're interested in the docs for a different Python version.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,901
4,714

kilon

macrumors newbie
Nov 12, 2008
17
1
Athens , Greece
Ok great! Thank you for the replies.

On macos coding for python is far easier because

a) Python is already installed in MacOS
b) Apple unlike Microsoft fully supports Python offering full access to the OS libraries from python as well as documentation of how to do this

installing XCODE will also give you a very powerful IDE with python support and many more advantages
 

Stella

macrumors G3
Apr 21, 2003
8,458
5,197
Canada
Python is vastly easier than on Windows.. for the reason above.

Pycharm community is a free IDE that you can use. Better than using Xcode or Sublime IMO.
https://www.jetbrains.com/pycharm/download/

If your learning Python, your better off using sublime text or other editor - not an IDE - it will add more complexity.
 

jasnw

macrumors 6502a
Nov 15, 2013
809
839
Seattle Area (NOT! Microsoft)
The only thing to keep an eye on is the python version. At present, El Capitan has the latest python 2 (2.7.10) but I've seen Mac OS lag behind the versions available from places like macports in the past. Also, if you're using python 3 you'll need to get that from elsewhere and install it. If you're just a casual user, however, you're probably using python 2 and will be OK.
 

ArtOfWarfare

macrumors G3
Nov 26, 2007
8,901
4,714
The only thing to keep an eye on is the python version. At present, El Capitan has the latest python 2 (2.7.10) but I've seen Mac OS lag behind the versions available from places like macports in the past. Also, if you're using python 3 you'll need to get that from elsewhere and install it. If you're just a casual user, however, you're probably using python 2 and will be OK.

If you're using 3 you get it from Python.org, no matter what platform.

Also, I was not aware that El Capitan came with 2.7.10. That's interesting and good.

So is pip available now on OS X completely out of the box? I'm pretty sure it's bundled with Python as of version 2.7.9 or so...
 

kilon

macrumors newbie
Nov 12, 2008
17
1
Athens , Greece
If you're using 3 you get it from Python.org, no matter what platform.

Also, I was not aware that El Capitan came with 2.7.10. That's interesting and good.

So is pip available now on OS X completely out of the box? I'm pretty sure it's bundled with Python as of version 2.7.9 or so...

I think pip was bundled way before that, the only thing that needed installation and probably still does is easy_install

bare in mind that 2.7 and 3 are diffirent beasts, Apple supports 2.7 because its by far the most popular, python 3 has a new syntax and python 2 apps wont work without modification. So if you want the most support and most libraries go with Apple's python 2.7 but if you want future support for long term projects go with python 3.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.