xuzhengfu / pilot

进入编程世界的第一课
1 stars 0 forks source link

安装软件包管理工具 Homebrew #9

Open xuzhengfu opened 4 years ago

xuzhengfu commented 4 years ago

1. 安装 Apple 开发工具包

1.1 执行命令 xcode-select -v

之前已安装 xcode-select,执行命令 xcode-select -v,显示如下:

xcode-select version 2354.
(base)

2. 安装 Homebrew

2.1 执行命令 brew -v

因为之前已安装 Homebrew,执行命令 brew -v,显示如下:

Homebrew 2.0.4
Homebrew/homebrew-core (git revision c508; last commit 2019-03-15)
Homebrew/homebrew-cask (git revision 8600d; last commit 2019-03-15)
(base)

2.2 执行命令 brew update

运行 Homebrew 自更新命令 brew update,结果等了 2 分钟,无任何反应 (在 1 分钟时,打开了 VPN),于是 control + c,显示如下:

^C/usr/local/Homebrew/Library/Homebrew/cmd/update.sh: line 290: 3698 Terminated: 15     ( if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]; then

[[ -n "$(find "$DIR/.git/FETCH_HEAD" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]] && exit;

fi; UPSTREAM_REPOSITORY_URL="$(git config remote.origin.url)"; if [[ "$UPSTREAM_REPOSITORY_URL" = "https://github.com/"* ]]; then

UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY_URL#https://github.com/}"; UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY%.git}"; if [[ "$DIR" = "$HOMEBREW_REPOSITORY" && -n "$HOMEBREW_UPDATE_TO_TAG" ]]; then

​    GITHUB_API_ETAG="$(sed -n 's/^ETag: "\([a-f0-9]\{32\}\)".*/\1/p' ".git/GITHUB_HEADERS" 2>/dev/null)"; GITHUB_API_ACCEPT="application/vnd.github.v3+json"; GITHUB_API_ENDPOINT="tags";

else

​    GITHUB_API_ETAG="$(git rev-parse "refs/remotes/origin/$UPSTREAM_BRANCH_DIR")"; GITHUB_API_ACCEPT="application/vnd.github.v3.sha"; GITHUB_API_ENDPOINT="commits/$UPSTREAM_BRANCH_DIR";

fi; UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL"      "${CURL_DISABLE_CURLRC_ARGS[@]}"      --silent --max-time 3      --location --output /dev/null --write-out "%{http_code}"      --dump-header "$DIR/.git/GITHUB_HEADERS"      --user-agent "$HOMEBREW_USER_AGENT_CURL"      --header "Accept: $GITHUB_API_ACCEPT"      --header "If-None-Match: \"$GITHUB_API_ETAG\""      "https://api.github.com/repos/$UPSTREAM_REPOSITORY/$GITHUB_API_ENDPOINT")"; [[ -f "$DIR/.git/FETCH_HEAD" ]] && touch "$DIR/.git/FETCH_HEAD"; [[ -z "$HOMEBREW_UPDATE_FORCE" ]] && [[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit;

else

if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]; then

​    FORCE_AUTO_UPDATE="$(git config homebrew.forceautoupdate 2>/dev/null || echo "false")"; if [[ "$FORCE_AUTO_UPDATE" != "true" ]]; then

​      exit;

​    fi;

fi;

fi; if [[ -n "$HOMEBREW_VERBOSE" ]]; then

echo "Fetching $DIR...";

fi; if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]; then

git fetch --tags --force "${QUIET_ARGS[@]}" origin "refs/heads/$UPSTREAM_BRANCH_DIR:refs/remotes/origin/$UPSTREAM_BRANCH_DIR" 2> /dev/null;

else

if ! git fetch --tags --force "${QUIET_ARGS[@]}" origin "refs/heads/$UPSTREAM_BRANCH_DIR:refs/remotes/origin/$UPSTREAM_BRANCH_DIR"; then

​    if [[ "$UPSTREAM_SHA_HTTP_CODE" = "404" ]]; then

​      TAP="${DIR#$HOMEBREW_LIBRARY/Taps/}"; echo "$TAP does not exist! Run 'brew untap $TAP'" >> "$update_failed_file";

​    else

​      echo "Fetching $DIR failed!" >> "$update_failed_file";

​    fi;

fi;

fi ) (wd: /usr/local/Homebrew)

/usr/local/Homebrew/Library/Homebrew/cmd/update.sh: line 290: 3714 Terminated: 15     ( if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]; then

[[ -n "$(find "$DIR/.git/FETCH_HEAD" -type f -mtime -"${HOMEBREW_AUTO_UPDATE_SECS}"s 2>/dev/null)" ]] && exit;

fi; UPSTREAM_REPOSITORY_URL="$(git config remote.origin.url)"; if [[ "$UPSTREAM_REPOSITORY_URL" = "https://github.com/"* ]]; then

UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY_URL#https://github.com/}"; UPSTREAM_REPOSITORY="${UPSTREAM_REPOSITORY%.git}"; if [[ "$DIR" = "$HOMEBREW_REPOSITORY" && -n "$HOMEBREW_UPDATE_TO_TAG" ]]; then

​    GITHUB_API_ETAG="$(sed -n 's/^ETag: "\([a-f0-9]\{32\}\)".*/\1/p' ".git/GITHUB_HEADERS" 2>/dev/null)"; GITHUB_API_ACCEPT="application/vnd.github.v3+json"; GITHUB_API_ENDPOINT="tags";

else

​    GITHUB_API_ETAG="$(git rev-parse "refs/remotes/origin/$UPSTREAM_BRANCH_DIR")"; GITHUB_API_ACCEPT="application/vnd.github.v3.sha"; GITHUB_API_ENDPOINT="commits/$UPSTREAM_BRANCH_DIR";

fi; UPSTREAM_SHA_HTTP_CODE="$("$HOMEBREW_CURL"      "${CURL_DISABLE_CURLRC_ARGS[@]}"      --silent --max-time 3      --location --output /dev/null --write-out "%{http_code}"      --dump-header "$DIR/.git/GITHUB_HEADERS"      --user-agent "$HOMEBREW_USER_AGENT_CURL"      --header "Accept: $GITHUB_API_ACCEPT"      --header "If-None-Match: \"$GITHUB_API_ETAG\""      "https://api.github.com/repos/$UPSTREAM_REPOSITORY/$GITHUB_API_ENDPOINT")"; [[ -f "$DIR/.git/FETCH_HEAD" ]] && touch "$DIR/.git/FETCH_HEAD"; [[ -z "$HOMEBREW_UPDATE_FORCE" ]] && [[ "$UPSTREAM_SHA_HTTP_CODE" = "304" ]] && exit;

else

if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]; then

​    FORCE_AUTO_UPDATE="$(git config homebrew.forceautoupdate 2>/dev/null || echo "false")"; if [[ "$FORCE_AUTO_UPDATE" != "true" ]]; then

​      exit;

​    fi;

fi;

fi; if [[ -n "$HOMEBREW_VERBOSE" ]]; then

echo "Fetching $DIR...";

fi; if [[ -n "$HOMEBREW_UPDATE_PREINSTALL" ]]; then

git fetch --tags --force "${QUIET_ARGS[@]}" origin "refs/heads/$UPSTREAM_BRANCH_DIR:refs/remotes/origin/$UPSTREAM_BRANCH_DIR" 2> /dev/null;

else

if ! git fetch --tags --force "${QUIET_ARGS[@]}" origin "refs/heads/$UPSTREAM_BRANCH_DIR:refs/remotes/origin/$UPSTREAM_BRANCH_DIR"; then

​    if [[ "$UPSTREAM_SHA_HTTP_CODE" = "404" ]]; then

​      TAP="${DIR#$HOMEBREW_LIBRARY/Taps/}"; echo "$TAP does not exist! Run 'brew untap $TAP'" >> "$update_failed_file";

​    else

​      echo "Fetching $DIR failed!" >> "$update_failed_file";

​    fi;

fi;

fi ) (wd: /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask)

(base)

2.3 执行命令 brew update

再执行一次 brew update,等待2分钟,还是无反应。control + c,显示如下:

^C(base)

2.4 执行命令 brew doctor

不知道发生了什么,以及接下来该做什么,于是,接着执行了下一个命令 brew doctor,显示如下:

Please note that these warnings are just used to help the Homebrew maintainers

with debugging if you file an issue. If everything you use Homebrew for is

working fine: please don't worry or file an issue; just ignore this. Thanks!

Warning: The following directories do not exist:

/usr/local/sbin

You should create these directories and change their ownership to your account.

sudo mkdir -p /usr/local/sbin

sudo chown -R $(whoami) /usr/local/sbin

Warning: "config" scripts exist outside your system or Homebrew directories.

`./configure` scripts often look for *-config scripts to determine if

software packages are installed, and what additional flags to use when

compiling and linking.

Having additional scripts in your path can confuse software installed via

Homebrew if the config script overrides a system or Homebrew provided

script of the same name. We found the following "config" scripts:

/Users/xuzhengfu/anaconda3/bin/icu-config

/Users/xuzhengfu/anaconda3/bin/krb5-config

/Users/xuzhengfu/anaconda3/bin/freetype-config

/Users/xuzhengfu/anaconda3/bin/xslt-config

/Users/xuzhengfu/anaconda3/bin/libpng16-config

/Users/xuzhengfu/anaconda3/bin/python3.7-config

/Users/xuzhengfu/anaconda3/bin/libpng-config

/Users/xuzhengfu/anaconda3/bin/xml2-config

/Users/xuzhengfu/anaconda3/bin/python3.7m-config

/Users/xuzhengfu/anaconda3/bin/python3-config

/Users/xuzhengfu/anaconda3/bin/curl-config

/Users/xuzhengfu/anaconda3/bin/ncursesw6-config

/Users/xuzhengfu/anaconda3/bin/pcre-config

Warning: Unbrewed dylibs were found in /usr/local/lib.

If you didn't put them there on purpose they could cause problems when

building Homebrew formulae, and may need to be deleted.

Unexpected dylibs:

/usr/local/lib/libnnz11.dylib

/usr/local/lib/libociei.dylib

/usr/local/lib/libocijdbc11.dylib

(base)

很随意地翻了一会儿原仓库 issues,有类似问题,好像不要紧,具体咋回事还不清楚,不过我要去睡觉了……

2.5 执行命令 brew update

第二天下午,再次执行 brew update,显示如下:

==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.6.3.mavericks.bottle.tar.gz

\######################################################################## 100.0%

==> Pouring portable-ruby-2.6.3.mavericks.bottle.tar.gz

==> Homebrew has enabled anonymous aggregate formulae and cask analytics.

Read the analytics documentation (and how to opt-out) here:

https://docs.brew.sh/Analytics

Updated 2 taps (homebrew/core and homebrew/cask).

==> New Formulae

adios2                 lazydocker

aliyun-cli               lazygit

………… 老长的 2 列 —— 从左到右按 A~Z 的顺序排列,中间的这些都被我删掉了,否则太难 review ……

libpeas                 zurl

libphonenumber             zydis

==> Renamed Formulae

bro -> zeek

confluent-oss -> confluent-platform

gnatsd -> nats-server

i386-elf-binutils -> x86_64-elf-binutils

i386-elf-gcc -> x86_64-elf-gcc

jupyter -> jupyterlab

kubernetes-helm -> helm

presto -> prestodb

transmission -> transmission-cli

usbmuxd -> libusbmuxd

==> Deleted Formulae

openssl ✔         hana            pound

aap            headphones         protobuf@2.5

………… 不怎么长的 3 列 —— 依旧是从左到右按 A~Z 的顺序排列,中间的这些也都被我删掉了 ……

gtk-murrine-engine     plan9port         zxing-cpp

guile@2.0         postgres-xc

(base) 

这是更新成功的意思么?不太确定,但好像是的…… 那我可以进行下一步了。

3. 用 brew 安装 python 和 git

3.1 执行命令 git --versionpython --version

之前已安装 git 和 python,执行命令 git --version,显示如下:

git version 2.17.1
(base)

执行命令 python --version,显示如下:

Python 3.7.1
(base) 

既然我已经安装过了,那我就可以进行下一步了。

3.2 执行命令 brew list

以查看已经安装好的这两个软件包以及所有自动安装的依赖包,显示如下:

autoconf    libgpg-error    libyaml     readline

automake    libidn2     nvm     wget

coreutils   libksba     openssl

gettext     libtool     openssl@1.1

git     libunistring    pkg-config

(base) 

嗯,看到里面有 git 了,哎,怎么没 python 啊?正好下一个指令是查看 python 版本的,先来试试看……

3.3 执行命令 python3 -v

以查看新安装的 Python 的版本,显示如下:

import _frozen_importlib # frozen

import _imp # builtin

import '_thread' # <class '_frozen_importlib.BuiltinImporter'>

import '_warnings' # <class '_frozen_importlib.BuiltinImporter'>

import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>

\# installing zipimport hook

import 'zipimport' # <class '_frozen_importlib.BuiltinImporter'>

\# installed zipimport hook

import '_frozen_importlib_external' # <class '_frozen_importlib.FrozenImporter'>

import '_io' # <class '_frozen_importlib.BuiltinImporter'>

import 'marshal' # <class '_frozen_importlib.BuiltinImporter'>

import 'posix' # <class '_frozen_importlib.BuiltinImporter'>

import _thread # previously loaded ('_thread')

import '_thread' # <class '_frozen_importlib.BuiltinImporter'>

import _weakref # previously loaded ('_weakref')

import '_weakref' # <class '_frozen_importlib.BuiltinImporter'>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/encodings/__pycache__/__init__.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/encodings/__init__.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/encodings/__pycache__/__init__.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/codecs.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/codecs.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/codecs.cpython-37.pyc'

import '_codecs' # <class '_frozen_importlib.BuiltinImporter'>

import 'codecs' # <_frozen_importlib_external.SourceFileLoader object at 0x1038d8240>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/encodings/__pycache__/aliases.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/encodings/aliases.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/encodings/__pycache__/aliases.cpython-37.pyc'

import 'encodings.aliases' # <_frozen_importlib_external.SourceFileLoader object at 0x1038e6d68>

import 'encodings' # <_frozen_importlib_external.SourceFileLoader object at 0x1038d2c88>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/encodings/__pycache__/utf_8.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/encodings/utf_8.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/encodings/__pycache__/utf_8.cpython-37.pyc'

import 'encodings.utf_8' # <_frozen_importlib_external.SourceFileLoader object at 0x1038f7a90>

import '_signal' # <class '_frozen_importlib.BuiltinImporter'>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/encodings/__pycache__/latin_1.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/encodings/latin_1.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/encodings/__pycache__/latin_1.cpython-37.pyc'

import 'encodings.latin_1' # <_frozen_importlib_external.SourceFileLoader object at 0x1038fc518>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/io.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/io.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/io.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/abc.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/abc.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/abc.cpython-37.pyc'

import '_abc' # <class '_frozen_importlib.BuiltinImporter'>

import 'abc' # <_frozen_importlib_external.SourceFileLoader object at 0x1038fcac8>

import 'io' # <_frozen_importlib_external.SourceFileLoader object at 0x1038fc710>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/site.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/site.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/site.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/os.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/os.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/os.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/stat.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/stat.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/stat.cpython-37.pyc'

import '_stat' # <class '_frozen_importlib.BuiltinImporter'>

import 'stat' # <_frozen_importlib_external.SourceFileLoader object at 0x103976cc0>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/posixpath.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/posixpath.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/posixpath.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/genericpath.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/genericpath.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/genericpath.cpython-37.pyc'

import 'genericpath' # <_frozen_importlib_external.SourceFileLoader object at 0x1039817b8>

import 'posixpath' # <_frozen_importlib_external.SourceFileLoader object at 0x10397c438>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/_collections_abc.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/_collections_abc.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/_collections_abc.cpython-37.pyc'

import '_collections_abc' # <_frozen_importlib_external.SourceFileLoader object at 0x103981dd8>

import 'os' # <_frozen_importlib_external.SourceFileLoader object at 0x10390c9b0>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/_sitebuiltins.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/_sitebuiltins.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/_sitebuiltins.cpython-37.pyc'

import '_sitebuiltins' # <_frozen_importlib_external.SourceFileLoader object at 0x10390cd68>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/_bootlocale.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/_bootlocale.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/_bootlocale.cpython-37.pyc'

import '_locale' # <class '_frozen_importlib.BuiltinImporter'>

import '_bootlocale' # <_frozen_importlib_external.SourceFileLoader object at 0x103971ac8>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/types.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/types.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/types.cpython-37.pyc'

import 'types' # <_frozen_importlib_external.SourceFileLoader object at 0x1039bcba8>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/importlib/__pycache__/__init__.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/importlib/__init__.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/importlib/__pycache__/__init__.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/warnings.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/warnings.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/warnings.cpython-37.pyc'

import 'warnings' # <_frozen_importlib_external.SourceFileLoader object at 0x1039c1a20>

import 'importlib' # <_frozen_importlib_external.SourceFileLoader object at 0x1039c16a0>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/importlib/__pycache__/util.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/importlib/util.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/importlib/__pycache__/util.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/importlib/__pycache__/abc.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/importlib/abc.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/importlib/__pycache__/abc.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/importlib/__pycache__/machinery.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/importlib/machinery.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/importlib/__pycache__/machinery.cpython-37.pyc'

import 'importlib.machinery' # <_frozen_importlib_external.SourceFileLoader object at 0x1039d5588>

import 'importlib.abc' # <_frozen_importlib_external.SourceFileLoader object at 0x1039cacf8>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/contextlib.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/contextlib.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/contextlib.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/collections/__pycache__/__init__.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/collections/__init__.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/collections/__pycache__/__init__.cpython-37.pyc'

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/operator.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/operator.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/operator.cpython-37.pyc'

import '_operator' # <class '_frozen_importlib.BuiltinImporter'>

import 'operator' # <_frozen_importlib_external.SourceFileLoader object at 0x103a2bc88>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/keyword.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/keyword.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/keyword.cpython-37.pyc'

import 'keyword' # <_frozen_importlib_external.SourceFileLoader object at 0x103a33e48>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/heapq.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/heapq.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/heapq.cpython-37.pyc'

\# extension module '_heapq' loaded from '/Users/xuzhengfu/anaconda3/lib/python3.7/lib-dynload/_heapq.cpython-37m-darwin.so'

\# extension module '_heapq' executed from '/Users/xuzhengfu/anaconda3/lib/python3.7/lib-dynload/_heapq.cpython-37m-darwin.so'

import '_heapq' # <_frozen_importlib_external.ExtensionFileLoader object at 0x103a37d68>

import 'heapq' # <_frozen_importlib_external.SourceFileLoader object at 0x103a377f0>

import 'itertools' # <class '_frozen_importlib.BuiltinImporter'>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/reprlib.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/reprlib.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/reprlib.cpython-37.pyc'

import 'reprlib' # <_frozen_importlib_external.SourceFileLoader object at 0x103a37e48>

import '_collections' # <class '_frozen_importlib.BuiltinImporter'>

import 'collections' # <_frozen_importlib_external.SourceFileLoader object at 0x1039e4e48>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/functools.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/functools.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/functools.cpython-37.pyc'

import '_functools' # <class '_frozen_importlib.BuiltinImporter'>

import 'functools' # <_frozen_importlib_external.SourceFileLoader object at 0x103a13278>

import 'contextlib' # <_frozen_importlib_external.SourceFileLoader object at 0x1039d5400>

import 'importlib.util' # <_frozen_importlib_external.SourceFileLoader object at 0x1039ca0b8>

\# possible namespace for /Users/xuzhengfu/anaconda3/lib/python3.7/site-packages/mpl_toolkits

\# possible namespace for /Users/xuzhengfu/anaconda3/lib/python3.7/site-packages/mpl_toolkits

\# destroy mpl_toolkits

\# possible namespace for /Users/xuzhengfu/anaconda3/lib/python3.7/site-packages/mpl_toolkits

\# destroy mpl_toolkits

import 'site' # <_frozen_importlib_external.SourceFileLoader object at 0x1039026a0>

Python 3.7.1 (default, Dec 14 2018, 13:28:58) 

[Clang 4.0.1 (tags/RELEASE_401/final)] :: Anaconda, Inc. on darwin

Type "help", "copyright", "credits" or "license" for more information.

\# extension module 'readline' loaded from '/Users/xuzhengfu/anaconda3/lib/python3.7/lib-dynload/readline.cpython-37m-darwin.so'

\# extension module 'readline' executed from '/Users/xuzhengfu/anaconda3/lib/python3.7/lib-dynload/readline.cpython-37m-darwin.so'

import 'readline' # <_frozen_importlib_external.ExtensionFileLoader object at 0x103a785c0>

import 'atexit' # <class '_frozen_importlib.BuiltinImporter'>

\# /Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/rlcompleter.cpython-37.pyc matches /Users/xuzhengfu/anaconda3/lib/python3.7/rlcompleter.py

\# code object from '/Users/xuzhengfu/anaconda3/lib/python3.7/__pycache__/rlcompleter.cpython-37.pyc'

import 'rlcompleter' # <_frozen_importlib_external.SourceFileLoader object at 0x103a786d8>

\>>> 

KeyboardInterrupt

\>>> 

[1]+ Stopped         python3 -v

(base)

我草,这什么乱七八糟的,我看到里面有 “anaconda3”,肯定是 anaconda 给弄得,看来我还是得用 brew 装个 python……

3.4 执行命令 brew install python

显示如下:

Updating Homebrew...

==> Installing dependencies for python: gdbm, openssl@1.1, readline, sqlite and xz

==> Installing python dependency: gdbm

==> Downloading https://homebrew.bintray.com/bottles/gdbm-1.18.1.mojave.bottle.

\######################################################################## 100.0%

==> Pouring gdbm-1.18.1.mojave.bottle.1.tar.gz

🍺 /usr/local/Cellar/gdbm/1.18.1: 20 files, 586.8KB

==> Installing python dependency: openssl@1.1

==> Downloading https://homebrew.bintray.com/bottles/openssl@1.1-1.1.1d.mojave.

==> Downloading from https://akamai.bintray.com/10/104ef018b7bb8fcc49f57e5a6035

\######################################################################## 100.0%

==> Pouring openssl@1.1-1.1.1d.mojave.bottle.tar.gz

==> Caveats

A CA file has been bootstrapped using certificates from the system

keychain. To add additional certificates, place .pem files in

/usr/local/etc/openssl@1.1/certs

and run

/usr/local/opt/openssl@1.1/bin/c_rehash

openssl@1.1 is keg-only, which means it was not symlinked into /usr/local,

because openssl/libressl is provided by macOS so don't link an incompatible version.

If you need to have openssl@1.1 first in your PATH run:

echo 'export PATH="/usr/local/opt/openssl@1.1/bin:$PATH"' >> ~/.bash_profile

For compilers to find openssl@1.1 you may need to set:

export LDFLAGS="-L/usr/local/opt/openssl@1.1/lib"

export CPPFLAGS="-I/usr/local/opt/openssl@1.1/include"

For pkg-config to find openssl@1.1 you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/openssl@1.1/lib/pkgconfig"

==> Summary

🍺 /usr/local/Cellar/openssl@1.1/1.1.1d: 7,983 files, 17.9MB

==> Installing python dependency: readline

==> Downloading https://homebrew.bintray.com/bottles/readline-8.0.1.mojave.bott

==> Downloading from https://akamai.bintray.com/3c/3c754391e9d243835811d128771c

\######################################################################## 100.0%

==> Pouring readline-8.0.1.mojave.bottle.tar.gz

==> Caveats

readline is keg-only, which means it was not symlinked into /usr/local,

because macOS provides the BSD libedit library, which shadows libreadline.

In order to prevent conflicts when programs look for libreadline we are

defaulting this GNU Readline installation to keg-only.

For compilers to find readline you may need to set:

export LDFLAGS="-L/usr/local/opt/readline/lib"

export CPPFLAGS="-I/usr/local/opt/readline/include"

For pkg-config to find readline you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/readline/lib/pkgconfig"

==> Summary

🍺 /usr/local/Cellar/readline/8.0.1: 48 files, 1.5MB

==> Installing python dependency: sqlite

==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.30.1.mojave.bottl

==> Downloading from https://akamai.bintray.com/5e/5e6fef2d754e0e4009d502c40ad1

\######################################################################## 100.0%

==> Pouring sqlite-3.30.1.mojave.bottle.tar.gz

==> Caveats

sqlite is keg-only, which means it was not symlinked into /usr/local,

because macOS provides an older sqlite3.

If you need to have sqlite first in your PATH run:

echo 'export PATH="/usr/local/opt/sqlite/bin:$PATH"' >> ~/.bash_profile

For compilers to find sqlite you may need to set:

export LDFLAGS="-L/usr/local/opt/sqlite/lib"

export CPPFLAGS="-I/usr/local/opt/sqlite/include"

For pkg-config to find sqlite you may need to set:

export PKG_CONFIG_PATH="/usr/local/opt/sqlite/lib/pkgconfig"

==> Summary

🍺 /usr/local/Cellar/sqlite/3.30.1: 11 files, 3.9MB

==> Installing python dependency: xz

==> Downloading https://homebrew.bintray.com/bottles/xz-5.2.4.mojave.bottle.tar

==> Downloading from https://akamai.bintray.com/01/010667293df282c8bceede3bcd36

\######################################################################## 100.0%

==> Pouring xz-5.2.4.mojave.bottle.tar.gz

🍺 /usr/local/Cellar/xz/5.2.4: 92 files, 1MB

==> Installing python

==> Downloading https://homebrew.bintray.com/bottles/python-3.7.6_1.mojave.bott

==> Downloading from https://akamai.bintray.com/64/643d627c2b4fc03a3286c397d299

\######################################################################## 100.0%

==> Pouring python-3.7.6_1.mojave.bottle.tar.gz

Error: An unexpected error occurred during the `brew link` step

The formula built, but is not symlinked into /usr/local

Permission denied @ dir_s_mkdir - /usr/local/Frameworks

Error: Permission denied @ dir_s_mkdir - /usr/local/Frameworks

(base)

看到有好多 “Caveats”,查了一下字典,是 “警告” 的意思,而且最后还有 “Error”,这一步肯定有问题。

3.5 执行命令 brew list

再执行命令 brew list,看看 python 装上没有,结果如下:

autoconf    git     libunistring    pkg-config  xz

automake    libgpg-error    libyaml     python

coreutils   libidn2     nvm     readline

gdbm        libksba     openssl     sqlite

gettext     libtool     openssl@1.1 wget

(base) 

看到 python 了!所以 Python 及相关依赖已经安装上了,可刚才怎么报错呢?

3.6 执行命令 python3 -v

再执行命令 python3 -v,查看一下安装上的 Python 的版本。结果和 「未 brew install python」前一样,还是那乱七八糟的一堆。

什么原因呢?

猜想:操作步骤与教程一致,除了 homebrew 的安装;尽管能够确定 homebrew 已安装,但 homebrew 的「安装位置」未必相同。故:卸载 homebrew,而后以「教程」提供的安装方式重新安装。

3.7 卸载 homebrew

在 spotlight 里面搜索 “homebrew”,试图查找原 “homebrew” 的安装地址,结果没有出现任何 “homebrew” 的文件夹,这是怎么回事?可是,到 /usr/local/ 目录下 ,却又发现了 homebrew 的文件夹。怎么卸载呢?直接删除这些文件夹吗?

很懵逼……

卸载 homebrew 的操作就此搁置。

3.8 执行命令 python3 -v

再执行命令 python3 -v 试试看。结果还是一样的,还是那乱七八糟的一堆,看着头疼,搞不定了,我得去提 issue 问问……

Logging

2020-02-03 21:41:12 搬到 GitHub 上,作格式调整,梳理内容及逻辑 2020-02-01 从 "安装 Homebrew".5 处继续推进任务 2020-01-31 initialize