Reputation: 85
I'm trying to get Python 3.5 to run in my terminal. I made a script using idle that printed out the version of python in use to try to solve my problem. The script looked like this:
import sys
print(sys.version_info)
When I ran it in IDLE, I got the following output:
sys.version_info(major=3, minor=5, micro=2, releaselevel='final', serial=0)
When I ran it in terminal, I got the following output instead:
sys.version_info(major=2, minor=7, micro=10, releaselevel='final', serial=0)
I want to be able to run my scripts in terminal because I want to be able to access files and use pip. If you know how I can do one or both of these things in the IDLE shell, or you know how to update terminal so I can do this.
Upvotes: 0
Views: 1196
Reputation: 1691
If you have Python installed, then:
python
or python2
opens the interactive prompt or runs a script if a file is supplied as an argumentpython3
does the same as above, but for Python 3Note that if Python 3 is set as the default Python version, then running python
will use Python 3
If you have IDLE installed, then:
idle2
opens IDLE for Python version 2idle3
opens IDLE for Python version 3 (unless you change the default python)If you want Python 3 to be the default Python version, then take a look at this SO question: How to set Python's default version to 3.3 on OS X? Be aware that there are some disadvantages and things to work around, so I advise you to read the entire article if you do so.
Upvotes: 1
Reputation: 1492
To run idle from command line Type idle3
in the terminal for Python 3
idle and if you want to run Python 2
idle, type idle
in the terminal .
Similarly, if you need to run a script or python prompt from terminal you should type python3
when you want to use Python 3
and python
when you want to run Python 2
.
Upvotes: 0