Python3 on mac

1. whereis python3 不显示命令的路径,但是python3 可用

不知什么时候安装的python3,但是

$ whereis python
/usr/bin/python
$ whereis python3

$ python3
Python 3.6.5 (default, Jun 17 2018, 12:13:06)
[GCC 4.2.1 Compatible Apple LLVM 9.1.0 (clang-902.0.39.2)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>

$ which python3
/usr/local/bin/python3

2. which 和whereis 区别

  • which

在$PATH变量下找到可运行的程序

$ man which 

WHICH(1)                  BSD General Commands Manual                 WHICH(1)

NAME
     which -- locate a program file in the user's path

SYNOPSIS
     which [-as] program ...

DESCRIPTION
     The which utility takes a list of command names and searches the path for each executable file
     that would be run had these commands actually been invoked.

     The following options are available:

     -a      List all instances of executables found (instead of just the first one of each).
  • whereis

在标准二进制文件夹 下寻找特定的程序

$ man whereis

WHEREIS(1)                BSD General Commands Manual               WHEREIS(1)

NAME
     whereis -- locate programs

SYNOPSIS
     whereis [program ...]

DESCRIPTION
     The whereis utility checks the standard binary directories for the specified programs, print-
     ing out the paths of any it finds.

     The path searched is the string returned by the sysctl(8) utility for the ``user.cs_path''
     string.

3. homebrew 安装的python3

Homebrew 将软件包分装到单独的目录(/usr/local/Cellar)

$ ll /usr/local/bin/python3
lrwxr-xr-x  1 36B  6 29 12:43 python3 -> ../Cellar/python/3.6.5_1/bin/python3

$ ll /usr/local/Cellar/python/3.6.5_1
lrwxr-xr-x   1  wheel    18B  3 28 18:24 Headers -> include/python3.6m
-r-xr-xr-x   1  wheel   2.1M  6 29 12:43 Python
drwxr-xr-x   4   wheel   128B  3 28 18:24 Resources
drwxr-xr-x  16  wheel   512B  6 29 12:43 bin
drwxr-xr-x   3  wheel    96B  3 28 18:24 include
drwxr-xr-x   6  wheel   192B  3 28 18:24 lib
drwxr-xr-x   3  wheel    96B  3 28 18:24 share

你可能感兴趣的:(Python3 on mac)