|Feb 29, 2012, 01:33 AM||#1|
python3 on mac
Has anyone successfully got python3 to work on a mac?
I am trying to learn python, and have a book that teaches python3. my Mac only have python 2.7.2. So I install python3, yet every time I try to run a program I have written, it tries to run in python 2 and stops with syntax errors.
I know my code is good, it is a tiny program the problem is with
'print (end=" ")'
Which works with python3 but not python2.
How can I get this to work, so that I can learn this language easier? oh, and without compromising my mac.
Python3 doesn't have to be default, but I need to know how to run executables with it
|Mar 1, 2012, 01:27 AM||#3|
How do you launch the program?
You could try to launch it using the full path to the python 3 executable, wherever it is located. Example:
Depending on what you want to do eventually, learning python 2 might be more useful. Many useful libraries are still based on python 2.X. For GUI programming, it seems that at least TKinter is compatible with python 3 now.
|Mar 1, 2012, 09:27 AM||#4|
Post the actual command-line you used. The one that you wanted to run python3, but that ran the builtin python instead.
Post the exact title, author, and edition of the book you're using.
Also, run the following command and post the complete output:
|Mar 4, 2012, 05:44 AM||#5|
I think the problem is in the print statement, if I understand you correctly. One of the differences between python 2 and 3 is that 'print' is a function in python 3 instead of the thing it is in python 2. (I don't how to call it in python 2)
So print( "Hello, world!") in python 3 has to be written as print "Hello, world!" in python 2. (so without the parentheses.) I think you will be fine with Python 2.7.2 on a beginner level as long as you remember this.
Macrumors newbie, happy to be here! (And sorry if any of my English is incorrect)
|Mar 13, 2012, 05:30 PM||#6|
|Thread Tools||Search this Thread|
|thread||Thread Starter||Forum||Replies||Last Post|
|mac to windows and ten years later back to Mac, need some alternative app suggestions||debudebu||Mac Applications and Mac App Store||1||Apr 5, 2014 02:53 PM|
|Migration assistant (Mac - Mac). New mac has mutiple drives, can't pick the right one||Daftones||MacBook Pro||4||Aug 29, 2013 09:32 AM|
|Mac Mini not visible in Mac network (shared drives, remote desktop)||xterminated||OS X 10.8 Mountain Lion||1||Jul 19, 2013 12:13 PM|
|Linux and mac shared Data partition. (paragon extFS-mac, ntfs-mac, ntfs-3G ?)||HiDeHo||OS X 10.8 Mountain Lion||15||Jul 17, 2013 05:09 PM|
All times are GMT -5. The time now is 11:07 AM.