xuzhengfu / pilot

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

操作 如何使用配套学习用书 #12

Open xuzhengfu opened 4 years ago

xuzhengfu commented 4 years ago

1. 访问本书配套学习用书的共享代码仓库

  1. 点击右上角的 Fork 按钮;

  2. 点击 Clone or download 按钮,而后将这个 repo 的访问地址拷贝到系统剪贴板;

2. 把属于你的这个分叉 repo 克隆到你自己的机器本地来

  1. 打开命令行界面

  2. 输入 cd Code

  3. 输入 git clone,在空格后粘贴你前面拷贝的,你 fork 的 repo 的地址,然后输入回车 ↩︎

结果 cloning 速度只有 15 KiB/s,我猜测是因为我开了 VPN 的缘故。

  1. 关闭 VPN —— 在 clone 仍在进行的情况下。

结果发现命令行的 clone 进度没反应了。

  1. ⌃ + c,取消了 clone。

因为我开着 finder,可以看到 Code 目录中的 pilot-student 文件夹消失了。

  1. 重新执行这一步:输入 git clone,在空格后粘贴你前面拷贝的,你 fork 的 repo 的地址,然后输入回车 ↩︎

结束 cloning 速度只有 7.00 KiB/s,更慢了,我勒个去…… 太慢了。还是开 VPN 吧。

  1. 开启 VPN —— 在 clone 仍在进行的情况下。

连了 1、2 分钟没连上,关闭 WiFi,在有线的情况下连接 VPN,连上了。但是,命令行的 clone 进度已经没反应了。

  1. ⌃ + c,取消了 clone。

  2. 在 VPN 开启的情况下,连接 WiFi,成功;

  3. 重新执行这一步:输入 git clone,在空格后粘贴你前面拷贝的,你 fork 的 repo 的地址,然后输入回车 ↩︎

结果如下:

Cloning into 'pilot-student'...
fatal: unable to access 'https://github.com/Xuzhengfu/pilot-student.git/': Could not resolve host: github.com
  1. 在 VPN 开启的情况下,关闭 WiFi,成功;

  2. 重新执行这一步:输入 git clone,在空格后粘贴你前面拷贝的,你 fork 的 repo 的地址,然后输入回车 ↩︎

结果依旧如下:

Cloning into 'pilot-student'...
fatal: unable to access 'https://github.com/Xuzhengfu/pilot-student.git/': Could not resolve host: github.com
  1. 关闭 命令行,关闭 VPN,重新连接 VPN,连接成功;

  2. 打开命令行界面

  3. 输入 cd Code

  4. 输入 git clone,在空格后粘贴你前面拷贝的,你 fork 的 repo 的地址,然后输入回车 ↩︎

cloning…… 但速度只有 60.00 KiB/s 左右,算了,不折腾了,让它慢慢 clone 吧。结果不过 2 分钟不到的光景,就 clone 好了,也挺快的么……

结果如下:

Cloning into 'pilot-student'...
remote: Enumerating objects: 90, done.
remote: Total 90 (delta 0), reused 0 (delta 0), pack-reused 90
Unpacking objects: 100% (90/90), 8.81 MiB | 48.00 KiB/s, done.
  1. 输入 cd pilot-student

命令行显示如下:

xuzhengfu at xuzhengfudeiMac in ~/Code/pilot-student on master
$

3. 安装和运行 Jupyter Lab

3.1 运行命令 python -m pip install --upgrade pip

结果如下:

xuzhengfu at xuzhengfudeiMac in ~/Code/pilot-student on master
$ python -m pip install --upgrade pip
/usr/bin/python: No module named pip

3.2 运行命令 python -m pip3 install --upgrade pip3

结果如下:

$ python -m pip3 install --upgrade pip3
/usr/bin/python: No module named pip3

3.3 Google 错误信息

Google “/usr/bin/python: No module named pip” ,在第一页未发现类似的情况。

Google “/usr/bin/python vs /usr/local/bin/python”,发现了这里描述了一些可供参考的内容,提取出有用的信息,如下:

  1. Each installation of Python comes with its own pip.

  2. You've got multiple pythons installed, so which one is being used when you run the wrapper script pip? You don't know, because it depends on the shebang line that was written to that script when it was auto-generated. And that can actually change over time, e.g. each time you install the module it's potentially rewritten.

  3. By always invoking python directly, you always know which one you're getting — it's whatever one you have your PATH setup to find first. And if you want to install modules to a different python, you just change the name of the interpreter that you're invoking, e.g. /foo/python -m pip install quux vs /bar/python -m pip install quux.

综览上述信息,得出了如下结论:

在执行命令 python -m pip install --upgrade pip 时,使用的是 /usr/bin/python 的那个 python,而这个 python 里没有 pip。

3.4 提 issue ( 备份:#14 )

3.5 读其他人提过的 issue

提 issue 的时候,发现有人已经提过这个问题了…… 还是忘记了那个「提问前应该先搜索」的步骤。大致看了一遍,基本可以确定里面有解决方案,待会儿再仔细看看。

里面给出的解决方案是:

是的,你的系统里要用 python3 和 pip3 来使用对应功能,然后你可以 pip3 install jupyterlab 来继续安装 Jupyter Lab 了。

也就是说,我要执行的命令是:

python3 -m pip install --upgrade pip
pip3 install jupyterlab

3.6 运行命令 python3 -m pip install --upgrade pip

显示如下:

Collecting pip
  Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB)
     |████████████████████████████████| 1.4MB 123kB/s 
Installing collected packages: pip
  Found existing installation: pip 19.3.1
    Uninstalling pip-19.3.1:
      Successfully uninstalled pip-19.3.1
Successfully installed pip-20.0.2

3.7 在本机上查询有关 jupyterlab 的信息

  1. 记得之前装过 jupyterlab。在 spotlight 搜索 jupyterlab,在 Notes 里发现 3 篇内容;阅读后得知如下信息:

我曾使用 anaconda 安装了 visual studio code 和 jupyter notebook 和 jupyterlab

困惑:我已经卸载了 anaconda,可是 vdcode 并没有随之被卸载,同理,后者也应该没有被卸载,那在哪儿找到它们呢? 先在 finder 里找找看。没找到。

3.8 Google

  1. Google “uninstall jupyterlab”,发现了这个,阅读之。

和我的情况不太一样,我好像不是用 pip 装的。我得去读一下《自学是门手艺》,了解一下我是怎么装的 jupyter。

  1. 阅读《自学是门手艺》T-appendix.jupyter-installation-and-setup

注意:曾执行 code ~/Library/LaunchAgents/com.jupyter.lab.plist 命令,以致在 ~/Library/LaunchAgents/ 中创建了 com.jupyter.lab.plist 文件。它使得你不必每次都要跑到 Terminal 里启动 Jupyter lab,而把它配置成系统服务,每次开机启动它就自动运行,而你需要做的只不过是直接从浏览器中访问 http://localhost:8888/。若是用不到,记得将之删除

注意:而后,还曾在 Terminal 里执行:launchctl load ~/Library/LaunchAgents/com.jupyter.lab.plist, 如果我想重新启动这个服务,那么执行:

launchctl unload ~/Library/LaunchAgents/com.jupyter.lab.plist
launchctl load ~/Library/LaunchAgents/com.jupyter.lab.plist

总结:阅读完毕后,基本可以确定,jupyter 已经随着之前 anaconda 的卸载而被彻底卸载了,因为关于 jupyter 的一切命令都不能用了。除了留下的一个「开机自动启动」的配置文件。

3.9 运行命令 pip3 install jupyterlab

  1. 下载的过程很慢,尽管这些文件并不大。要命的是,网络中断了。草……

显示如下:

Collecting jupyterlab
  Downloading jupyterlab-1.2.6-py2.py3-none-any.whl (6.4 MB)
     |████████████████████████████████| 6.4 MB 19 kB/s 
Collecting jinja2>=2.10
  Downloading Jinja2-2.11.1-py2.py3-none-any.whl (126 kB)
     |████████████████████████████████| 126 kB 14 kB/s 
Collecting tornado!=6.0.0,!=6.0.1,!=6.0.2
  Downloading tornado-6.0.3.tar.gz (482 kB)
     |████████████████████████████████| 482 kB 11 kB/s 
Collecting notebook>=4.3.1
  Downloading notebook-6.0.3-py3-none-any.whl (9.7 MB)
     |████████████████████████████████| 9.7 MB 12 kB/s 
Collecting jupyterlab-server~=1.0.0
  Downloading jupyterlab_server-1.0.6-py3-none-any.whl (27 kB)
Collecting MarkupSafe>=0.23
  Downloading MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl (18 kB)
Collecting ipython-genutils
  Downloading ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB)
Collecting nbconvert
  Downloading nbconvert-5.6.1-py2.py3-none-any.whl (455 kB)
     |████████████████████████████████| 455 kB 17 kB/s 
Collecting pyzmq>=17
  Downloading pyzmq-18.1.1-cp37-cp37m-macosx_10_9_x86_64.whl (811 kB)
     |████████████████████████████████| 811 kB 15 kB/s 
Collecting terminado>=0.8.1
  Downloading terminado-0.8.3-py2.py3-none-any.whl (33 kB)
Collecting jupyter-core>=4.6.1
  Downloading jupyter_core-4.6.1-py2.py3-none-any.whl (82 kB)
     |████████████████████████████████| 82 kB 18 kB/s 
Collecting nbformat
  Downloading nbformat-5.0.4-py3-none-any.whl (169 kB)
     |████████████████████████████████| 169 kB 9.4 kB/s 
Collecting Send2Trash
  Downloading Send2Trash-1.5.0-py3-none-any.whl (12 kB)
Collecting traitlets>=4.2.1
  Downloading traitlets-4.3.3-py2.py3-none-any.whl (75 kB)
     |████████████████████████████████| 75 kB 11 kB/s 
Collecting prometheus-client
  Downloading prometheus_client-0.7.1.tar.gz (38 kB)
Collecting ipykernel
  Downloading ipykernel-5.1.4-py3-none-any.whl (116 kB)
     |████████████████████████████████| 116 kB 8.3 kB/s 
Collecting jupyter-client>=5.3.4
  Downloading jupyter_client-5.3.4-py2.py3-none-any.whl (92 kB)
     |████████████████████████████████| 92 kB 9.9 kB/s 
Collecting json5
  Downloading json5-0.9.0-py2.py3-none-any.whl (27 kB)
Collecting jsonschema>=3.0.1
  Downloading jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
     |████████████████████████████████| 56 kB 12 kB/s 
Collecting mistune<2,>=0.8.1
  Downloading mistune-0.8.4-py2.py3-none-any.whl (16 kB)
Collecting entrypoints>=0.2.2
  Downloading entrypoints-0.3-py2.py3-none-any.whl (11 kB)
Collecting testpath
  Downloading testpath-0.4.4-py2.py3-none-any.whl (163 kB)
     |████████████████████████        | 122 kB 11 kB/s eta 0:00:04ERROR: Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 425, in _error_catcher
    yield
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 507, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 457, in read
    n = self.readinto(b)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 501, in readinto
    n = self.fp.readinto(b)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 1071, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py", line 929, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/cli/base_command.py", line 186, in _main
    status = self.run(options, args)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/commands/install.py", line 331, in run
    resolver.resolve(requirement_set)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 177, in resolve
    discovered_reqs.extend(self._resolve_one(requirement_set, req))
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 333, in _resolve_one
    abstract_dist = self._get_abstract_dist_for(req_to_install)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/legacy_resolve.py", line 282, in _get_abstract_dist_for
    abstract_dist = self.preparer.prepare_linked_requirement(req)
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 482, in prepare_linked_requirement
    hashes=hashes,
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 287, in unpack_url
    hashes=hashes,
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 159, in unpack_http_url
    link, downloader, temp_dir.path, hashes
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/operations/prepare.py", line 303, in _download_http_url
    for chunk in download.chunks:
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/utils/ui.py", line 160, in iter
    for x in it:
  File "/usr/local/lib/python3.7/site-packages/pip/_internal/network/utils.py", line 39, in response_chunks
    decode_content=False,
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 564, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 529, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/local/Cellar/python/3.7.6_1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.7/site-packages/pip/_vendor/urllib3/response.py", line 430, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.
  1. 再次运行命令 pip3 install jupyterlab

结果如下:

Collecting jupyterlab
  Using cached jupyterlab-1.2.6-py2.py3-none-any.whl (6.4 MB)
Collecting jinja2>=2.10
  Using cached Jinja2-2.11.1-py2.py3-none-any.whl (126 kB)
Collecting notebook>=4.3.1
  Using cached notebook-6.0.3-py3-none-any.whl (9.7 MB)
Collecting jupyterlab-server~=1.0.0
  Using cached jupyterlab_server-1.0.6-py3-none-any.whl (27 kB)
Collecting tornado!=6.0.0,!=6.0.1,!=6.0.2
  Using cached tornado-6.0.3.tar.gz (482 kB)
Collecting MarkupSafe>=0.23
  Using cached MarkupSafe-1.1.1-cp37-cp37m-macosx_10_6_intel.whl (18 kB)
Collecting jupyter-core>=4.6.1
  Using cached jupyter_core-4.6.1-py2.py3-none-any.whl (82 kB)
Collecting ipykernel
  Using cached ipykernel-5.1.4-py3-none-any.whl (116 kB)
Collecting pyzmq>=17
  Using cached pyzmq-18.1.1-cp37-cp37m-macosx_10_9_x86_64.whl (811 kB)
Collecting Send2Trash
  Using cached Send2Trash-1.5.0-py3-none-any.whl (12 kB)
Collecting jupyter-client>=5.3.4
  Using cached jupyter_client-5.3.4-py2.py3-none-any.whl (92 kB)
Collecting prometheus-client
  Using cached prometheus_client-0.7.1.tar.gz (38 kB)
Collecting nbformat
  Using cached nbformat-5.0.4-py3-none-any.whl (169 kB)
Collecting terminado>=0.8.1
  Using cached terminado-0.8.3-py2.py3-none-any.whl (33 kB)
Collecting traitlets>=4.2.1
  Using cached traitlets-4.3.3-py2.py3-none-any.whl (75 kB)
Collecting nbconvert
  Using cached nbconvert-5.6.1-py2.py3-none-any.whl (455 kB)
Collecting ipython-genutils
  Using cached ipython_genutils-0.2.0-py2.py3-none-any.whl (26 kB)
Collecting json5
  Using cached json5-0.9.0-py2.py3-none-any.whl (27 kB)
Collecting jsonschema>=3.0.1
  Using cached jsonschema-3.2.0-py2.py3-none-any.whl (56 kB)
Collecting ipython>=5.0.0
  Downloading ipython-7.12.0-py3-none-any.whl (777 kB)
     |████████████████████████████████| 777 kB 99 kB/s 
Collecting appnope; platform_system == "Darwin"
  Downloading appnope-0.1.0-py2.py3-none-any.whl (4.0 kB)
Collecting python-dateutil>=2.1
  Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
     |████████████████████████████████| 227 kB 55 kB/s 
Collecting ptyprocess; os_name != "nt"
  Downloading ptyprocess-0.6.0-py2.py3-none-any.whl (39 kB)
Collecting decorator
  Downloading decorator-4.4.1-py2.py3-none-any.whl (9.2 kB)
Collecting six
  Downloading six-1.14.0-py2.py3-none-any.whl (10 kB)
Collecting mistune<2,>=0.8.1
  Using cached mistune-0.8.4-py2.py3-none-any.whl (16 kB)
Collecting entrypoints>=0.2.2
  Using cached entrypoints-0.3-py2.py3-none-any.whl (11 kB)
Collecting testpath
  Downloading testpath-0.4.4-py2.py3-none-any.whl (163 kB)
     |████████████████████████████████| 163 kB 71 kB/s 
Collecting bleach
  Downloading bleach-3.1.0-py2.py3-none-any.whl (157 kB)
     |████████████████████████████████| 157 kB 83 kB/s 
Collecting defusedxml
  Downloading defusedxml-0.6.0-py2.py3-none-any.whl (23 kB)
Collecting pygments
  Downloading Pygments-2.5.2-py2.py3-none-any.whl (896 kB)
     |████████████████████████████████| 896 kB 53 kB/s 
Collecting pandocfilters>=1.4.1
  Downloading pandocfilters-1.4.2.tar.gz (14 kB)
Requirement already satisfied: setuptools in /usr/local/lib/python3.7/site-packages (from jsonschema>=3.0.1->jupyterlab-server~=1.0.0->jupyterlab) (42.0.2)
Collecting pyrsistent>=0.14.0
  Downloading pyrsistent-0.15.7.tar.gz (107 kB)
     |████████████████████████████████| 107 kB 63 kB/s 
Collecting importlib-metadata; python_version < "3.8"
  Downloading importlib_metadata-1.5.0-py2.py3-none-any.whl (30 kB)
Collecting attrs>=17.4.0
  Downloading attrs-19.3.0-py2.py3-none-any.whl (39 kB)
Collecting jedi>=0.10
  Downloading jedi-0.16.0-py2.py3-none-any.whl (1.1 MB)
     |████████████████████████████████| 1.1 MB 61 kB/s 
Collecting backcall
  Downloading backcall-0.1.0.tar.gz (9.7 kB)
Collecting prompt-toolkit!=3.0.0,!=3.0.1,<3.1.0,>=2.0.0
  Downloading prompt_toolkit-3.0.3-py3-none-any.whl (348 kB)
     |████████████████████████████████| 348 kB 42 kB/s 
Collecting pickleshare
  Downloading pickleshare-0.7.5-py2.py3-none-any.whl (6.9 kB)
Collecting pexpect; sys_platform != "win32"
  Downloading pexpect-4.8.0-py2.py3-none-any.whl (59 kB)
     |████████████████████████████████| 59 kB 41 kB/s 
Collecting webencodings
  Downloading webencodings-0.5.1-py2.py3-none-any.whl (11 kB)
Collecting zipp>=0.5
  Downloading zipp-2.1.0-py3-none-any.whl (4.6 kB)
Collecting parso>=0.5.2
  Downloading parso-0.6.1-py2.py3-none-any.whl (97 kB)
     |████████████████████████████████| 97 kB 36 kB/s 
Collecting wcwidth
  Downloading wcwidth-0.1.8-py2.py3-none-any.whl (17 kB)
Building wheels for collected packages: tornado, prometheus-client, pandocfilters, pyrsistent, backcall
  Building wheel for tornado (setup.py) ... done
  Created wheel for tornado: filename=tornado-6.0.3-cp37-cp37m-macosx_10_14_x86_64.whl size=412732 sha256=a3307638e090916d454f364e0b8e6edf797590fe6d051e0fec8f4340f63d92a0
  Stored in directory: /Users/xuzhengfu/Library/Caches/pip/wheels/d0/31/2c/9406ed59f0dcdce0c453a8664124d738551590e74fc087f604
  Building wheel for prometheus-client (setup.py) ... done
  Created wheel for prometheus-client: filename=prometheus_client-0.7.1-py3-none-any.whl size=41402 sha256=39e541ea2d9f6067b207d052f2e5b39df5aff08635356cd30bf75aa51e257981
  Stored in directory: /Users/xuzhengfu/Library/Caches/pip/wheels/30/0c/26/59ba285bf65dc79d195e9b25e2ddde4c61070422729b0cd914
  Building wheel for pandocfilters (setup.py) ... done
  Created wheel for pandocfilters: filename=pandocfilters-1.4.2-py3-none-any.whl size=7855 sha256=8a5b8491430bdbc1bc670d1414cd693b59753fb18f238f4acaebf65758c08749
  Stored in directory: /Users/xuzhengfu/Library/Caches/pip/wheels/63/99/01/9fe785b86d1e091a6b2a61e06ddb3d8eb1bc9acae5933d4740
  Building wheel for pyrsistent (setup.py) ... done
  Created wheel for pyrsistent: filename=pyrsistent-0.15.7-cp37-cp37m-macosx_10_14_x86_64.whl size=68887 sha256=7059eb9d731a621a1559f5262f7695c8f44b59bde74f1675be837fd4716bb885
  Stored in directory: /Users/xuzhengfu/Library/Caches/pip/wheels/57/74/e3/61db397ec89f304e49711ec9f68490f15814b80c1c0ee9b8c0
  Building wheel for backcall (setup.py) ... done
  Created wheel for backcall: filename=backcall-0.1.0-py3-none-any.whl size=10412 sha256=cbf1888f2f6b80f8df18bd85bf2e9c788e20fd679cc8843dc583d4fb19db9360
  Stored in directory: /Users/xuzhengfu/Library/Caches/pip/wheels/9e/56/4f/da13e448a8a5b8671b2954600d5355cf36e557c7aa5020139b
Successfully built tornado prometheus-client pandocfilters pyrsistent backcall
Installing collected packages: MarkupSafe, jinja2, decorator, ipython-genutils, six, traitlets, jupyter-core, parso, jedi, backcall, wcwidth, prompt-toolkit, pickleshare, appnope, pygments, ptyprocess, pexpect, ipython, tornado, pyzmq, python-dateutil, jupyter-client, ipykernel, Send2Trash, prometheus-client, pyrsistent, zipp, importlib-metadata, attrs, jsonschema, nbformat, terminado, mistune, entrypoints, testpath, webencodings, bleach, defusedxml, pandocfilters, nbconvert, notebook, json5, jupyterlab-server, jupyterlab
Successfully installed MarkupSafe-1.1.1 Send2Trash-1.5.0 appnope-0.1.0 attrs-19.3.0 backcall-0.1.0 bleach-3.1.0 decorator-4.4.1 defusedxml-0.6.0 entrypoints-0.3 importlib-metadata-1.5.0 ipykernel-5.1.4 ipython-7.12.0 ipython-genutils-0.2.0 jedi-0.16.0 jinja2-2.11.1 json5-0.9.0 jsonschema-3.2.0 jupyter-client-5.3.4 jupyter-core-4.6.1 jupyterlab-1.2.6 jupyterlab-server-1.0.6 mistune-0.8.4 nbconvert-5.6.1 nbformat-5.0.4 notebook-6.0.3 pandocfilters-1.4.2 parso-0.6.1 pexpect-4.8.0 pickleshare-0.7.5 prometheus-client-0.7.1 prompt-toolkit-3.0.3 ptyprocess-0.6.0 pygments-2.5.2 pyrsistent-0.15.7 python-dateutil-2.8.1 pyzmq-18.1.1 six-1.14.0 terminado-0.8.3 testpath-0.4.4 tornado-6.0.3 traitlets-4.3.3 wcwidth-0.1.8 webencodings-0.5.1 zipp-2.1.0

之前安装过的,直接 using cache,不需要再下载一遍。挺好!

3.10 运行命令 brew install node

  1. 又是漫长等待中。等不急,跑去打了个电话,结果回来的时候网又断了,晕。

结果如下:

Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
git-annex-remote-rclone     grex                        rubyfmt
==> Updated Formulae
sqlite ✔                    gnutls                      paket
alot                        helmfile                    phpstan
annie                       helmsman                    poco
argyll-cms                  hlint                       ponyc
azure-cli                   hugo                        profanity
bit                         inlets                      protobuf
borgmatic                   janet                       radare2
cassandra                   lazygit                     rakudo
cfn-lint                    libomp                      rawtoaces
cheat                       libtasn1                    remind
clp                         libvirt                     rom-tools
coinutils                   libzip                      s-nail
composer                    luaradio                    sbt
csvq                        mame                        sqldiff
dbhash                      memcached                   sqlite-analyzer
deno                        mercurial                   starship
diamond                     micronaut                   swiftformat
django-completion           mmctl                       syncthing
docker-compose              moarvm                      taskell
docker-compose-completion   molten-vk                   tdlib
doctl                       mongo-c-driver              tektoncd-cli
dvc                         mono                        termshark
erlang                      movgrab                     terraform-docs
erlang@21                   netlify-cli                 tintin
exploitdb                   nifi                        ungit
ffuf                        nng                         util-linux
fonttools                   nqp                         varnish
frpc                        nspr                        vim
frps                        ocrmypdf                    whistle
geoserver                   openjdk                     wxmaxima
git-annex                   openjdk@11                  xmrig
gitmoji                     openjdk@12                  zint
==> Deleted Formulae
fstar                                      mldonkey

==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c
==> Downloading https://homebrew.bintray.com/bottles/icu4c-64.2.mojave.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/e8/e858556120acc0c2d52b8fb572b677856
######################################################################## 100.0%
==> Pouring icu4c-64.2.mojave.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /usr/local,
because macOS provides libicucore.dylib (but nothing else).

If you need to have icu4c first in your PATH run:
  echo 'export PATH="/usr/local/opt/icu4c/bin:$PATH"' >> ~/.bash_profile
  echo 'export PATH="/usr/local/opt/icu4c/sbin:$PATH"' >> ~/.bash_profile

For compilers to find icu4c you may need to set:
  export LDFLAGS="-L/usr/local/opt/icu4c/lib"
  export CPPFLAGS="-I/usr/local/opt/icu4c/include"

==> Summary
🍺  /usr/local/Cellar/icu4c/64.2: 257 files, 69.2MB
==> Installing node
==> Downloading https://homebrew.bintray.com/bottles/node-13.7.0.mojave.bottle.1.tar
==> Downloading from https://akamai.bintray.com/63/634b52994ab2142281692f9c8796ca28d
######                                                                     8.6%
  1. 再次运行命令 brew install node

结果如下:

Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/node-13.7.0.mojave.bottle.1.tar.gz
==> Downloading from https://akamai.bintray.com/63/634b52994ab2142281692f9c8796ca28d656aaab0f7
######################################################################## 100.0%
==> Pouring node-13.7.0.mojave.bottle.1.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/node/13.7.0: 4,663 files, 60.2MB

3.11 启动 Jupyter Lab

  1. 在你克隆好的学习用书目录里运行 jupyter lab ↩︎ 来启动 Jupyter Lab 的服务程序;被打开的浏览器页面里列出了学习用书里的所有 notebook(.ipynb 后缀名的文件),双击就能打开了。

  2. 需要退出时,在这个命令行窗口按 Control+C 组合键。

  3. 如果在 jupyter lab 运行着的时候你需要命令行界面执行一些任务,使用 command + T 在 terminal 里打开一个新的 tab 就可以了,不用动之前的那个。

4. 使用学习用书

  1. 在 Jupyter Lab 中打开 notebook(.ipynb 后缀名的文件);

  2. 在代码 cell 中输入 Python 代码并运行;

  3. 每学完一章,对应的学习用书中的 notebook 也应该经你亲手补完,做完之后保存 notebook。

4.1 使用 git commit 来把你修改的内容提交到本地仓库(local repo)

  1. 查看本地仓库状态,可以看到我在 notebook 更改的文件 —— p1-2-structure-1.ipynb
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
    modified:   p1-2-structure-1.ipynb

no changes added to commit (use "git add" and/or "git commit -a")
  1. 把修改的内容提交到本地仓库(local repo)
$ git add p1-2-structure-1.ipynb

xuzhengfu at xuzhengfudeiMac in ~/Code/pilot-student on master [+]
$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
    modified:   p1-2-structure-1.ipynb

xuzhengfu at xuzhengfudeiMac in ~/Code/pilot-student on master [+]
$ git commit
[master 3154d39] testing of committing first practice to local repo
 1 file changed, 27 insertions(+), 15 deletions(-)
  1. 使用 git push 来把你本地仓库中新的变化同步到 GitHub 上的远程仓库(remote repo)——这就是你的学习“工作证明(PoW)”。
xuzhengfu at xuzhengfudeiMac in ~/Code/pilot-student on master [!]
$ git push
Enumerating objects: 5, done.
Counting objects: 100% (5/5), done.
Delta compression using up to 4 threads
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 488 bytes | 488.00 KiB/s, done.
Total 3 (delta 2), reused 0 (delta 0)
remote: Resolving deltas: 100% (2/2), completed with 2 local objects.
To https://github.com/Xuzhengfu/pilot-student.git
   8a4219b..3154d39  master -> master
  1. 进入 GitHub 上的远程仓库(remote repo)—— Xuzhengfu/pilot-student,可以看到我在 p1-2-structure-1.ipynb 所做的修改已被 push 到 remote 仓库。

  2. 学习 视频指引,记录如下:

    • 打开教材,打开学习用书,并排放置
    • 一边在线读教材,一边在本地的学习用书中照着教材中的内容 “描红” 就可以了

Reference

  1. https://github.com/neolee/pilot/blob/master/x2-students-book.md
  2. https://www.reddit.com/r/learnpython/comments/4zqw0d/usrbinpython_vs_usrlocalbinpython/
  3. https://stackoverflow.com/questions/33052232/how-to-uninstall-jupyter
  4. 《自学是门手艺》T-appendix.jupyter-installation-and-setup

Logging

2020-02-05 21:56:06 initialize