python location on mac osx

前端 未结 12 1818
失恋的感觉
失恋的感觉 2020-11-28 02:02

I\'m a little confused with the python on osx. I do not know if the previous owner of the laptop has installed macpython using macport. And I remembered that osx has an buil

相关标签:
12条回答
  • 2020-11-28 02:26

    [GCC 4.2.1 (Apple Inc. build 5646)] is the version of GCC that the Python(s) were built with, not the version of Python itself. That information should be on the previous line. For example:

    # Apple-supplied Python 2.6 in OS X 10.6
    $ /usr/bin/python
    Python 2.6.1 (r261:67515, Jun 24 2010, 21:47:49) 
    [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> 
    
    # python.org Python 2.7.2 (also built with newer gcc)
    $ /usr/local/bin/python
    Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34) 
    [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>>
    

    Items in /usr/bin should always be or link to files supplied by Apple in OS X, unless someone has been ill-advisedly changing things there. To see exactly where the /usr/local/bin/python is linked to:

    $ ls -l /usr/local/bin/python
    lrwxr-xr-x  1 root  wheel  68 Jul  5 10:05 /usr/local/bin/python@ -> ../../../Library/Frameworks/Python.framework/Versions/2.7/bin/python
    

    In this case, that is typical for a python.org installed Python instance or it could be one built from source.

    0 讨论(0)
  • 2020-11-28 02:26

    I have a cook recipe for finding things in linux/macos

    First update the locate db then do a

    locate WHATiWANTtoSEARCH | less
    

    do a /find to find what you are looking for.

    to update your locate db in macos do this:

    sudo /usr/libexec/locate.updatedb
    

    it sometimes takes a while. Hope this helps :)

    0 讨论(0)
  • 2020-11-28 02:28

    I found the easiest way to locate it, you can use

    which python

    it will show something like this:

    /usr/bin/python

    0 讨论(0)
  • 2020-11-28 02:32

    On High Sierra

    which python
    

    shows the default python but if you downloaded and installed the latest version from python.org you can find it by:

    which python3.6
    

    which on my machine shows

    /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6
    
    0 讨论(0)
  • 2020-11-28 02:32

    installed with 'brew install python3', found it here

    0 讨论(0)
  • 2020-11-28 02:32

    which python3 simply result in a path in which the interpreter settles down.

    0 讨论(0)
提交回复
热议问题