You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Where do I find Python?

I know that mac-OS comes with an old version of Python. I can't remember how to access it on the Terminal. I'm pretty sure that I installed a newer version of Python on my mini. It doesn't show up in Applications. When I type the command in Terminal to start the new version of Python, the Terminal can't find the file. What is the path? Is a new version of Python installed in a different folder every time that I update Python? Is there a search command in Terminal to look for Python? How do I delete Python, including the 1 that comes with mac-OS?

Mac mini, macOS High Sierra (10.13)

Posted on Apr 18, 2018 11:35 AM

Reply

Similar questions

7 replies

Apr 18, 2018 12:08 PM in response to macnerd48

There are some fundamental differences between Python 2 and Python 3, such that both keep being developed side-by-side. P3 is not the successor to P2 like other software versions.

Latest Python 3 Release - Python 3.6.5 (2018-03-28)

Latest Python 2 Release - Python 2.7.14 (2017-09-16)

In development Python 3.7.0b3 (2018-03-29)

In development Python 2.7.15rc1 (2018-04-15)

Python documentation

Apr 18, 2018 12:30 PM in response to Urquhart1244

I should have been more clear.


Where in mac-OS do I find Python? In what folder on my hard drive? When I install a new version of Python on my mini, where is it installed in mac-OS? That's what I meant when I asked where the path is. I can't remember whether mac-OS uses a forward slash / or a back slash \.


I know that there's a Terminal command for starting the included Python but I don't remember what it is.


Is there a mac-OS equivalence to the Windows config.sys file that has paths to apps?

Apr 18, 2018 1:15 PM in response to macnerd48

Never remove, and/or replace the System installed python as several operating system components depend on this specific 2.7.10 version of Python. Use a package manager (e.g. homebrew), or install from the python.org installer to keep the python versions separate. The python installed by the operating system is /usr/bin/python.


Assuming that you have the proper (default) PATH environment variable setting, then you should be able to just type the following (in blue) from the Terminal command-line:


# launch the default python 2.7.10 interactive development environment (IDE)

$ idle &

$ python -c 'print("{}".format("Monty Python"))'

You use control-d to exit the idle utility. Note: I launch idle as a Bash background (&) task to free up the Terminal.


The alternate python installation choices usually put the python and idle binaries in /usr/local/bin, and shove the respective python version library into (for example, Python 3.6.5) at the following location:


/Library/Frameworks/Python.framework/Versions/3.6/lib


With the System python installation, the environment variable PYTHONPATH is unset. This, and other environment variables are discussed in the python documentation at python.org. But, when you install different Python versions (e.g. above), you must set this environment variable as the path to the specific Python version library. So as above, if you wanted to run the Python 3.6.5 that you installed with python.org's installer, you set the path to the dynamic framework library as:


$ export PYTHONPATH=/Library/Frameworks/Python.framework/Versions/3.6/lib


and then you could launch Python 3.6.5, or idle3 as:


$ python3

$ idle3 &


When you are done, and want to run the operating system python again, you unset the PYTHONPATH environment variable as:


$ unset PYTHONPATH


There are enough language version differences between python 2.7.14 and python 3.6.5 (presently) that depending on the particular library module used, that code that you write for python 2.7.n will not work with python 3.6.n without some planning. Some python 3 features have been back ported to python 2.

Apr 18, 2018 1:39 PM in response to VikingOSX

I'm sorry that I'm asking so many questions!


I don't see /usr/local/bin in Finder. Is that a hidden folder?


When I go to Finder, I see:

/Library/Frameworks/Python.framework/Versions/2.3

/Library/Frameworks/Python.framework/Versions/2.5

/Library/Frameworks/Python.framework/Versions/2.6

/Library/Frameworks/Python.framework/Versions/2.7

/Library/Frameworks/Python.framework/Versions/Current


Versions 2.3, 2.5, 2.6 & Current are aliases. Are they safe to delete or use the Terminal to delete?


If I don't unset the PYTHONPATH, will I lock up mac-OS? Can I have both the 2.7.10 & the current version of Python environment variables?


I'm learning!

Apr 18, 2018 2:23 PM in response to macnerd48

Python is not a GUI tool, and is not launchable/configurable from the Finder. Python is a scripting language, and by that very nature, it is intended to be used from the Terminal command-line, not Finder.


Once in the Terminal, you will automatically have /usr/local/bin and /usr/bin in your default PATH, and you can access Python from the Terminal command-line as I described in my previous post.

Where do I find Python?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.