Reputation: 59
I can use python 3 in terminal fine, but I don't know how to make it so terminal will run a program that I have written in python 3.
What do i have to do to associate the .py file extension with python3.2.3 for terminal and not python2.7.1
I am using textwrangler as my text editor, but will happily use any editor if it will run, though I don't think this is my problem as idle doesn't work either and it doesn't have line numbers in it either.
Kind regards
Rob
Upvotes: 2
Views: 3352
Reputation: 11467
Add a python3
hashbang to the beginning of your scripts:
#!/usr/bin/env python3
# do stuff
Then, you can make your script executable and run it:
chmod +x script.py
./script.py
Upvotes: 5
Reputation: 250871
try python3 yourprogram.py
in your terminal.
or by adding this line on the top of our programs, this is the path to your interpreter:
#!/usr/local/bin/python3.2
Upvotes: 1