(1) 安装 Homebrew
/usr/bin/Ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
如果是安装成功的话, 就会出现
- Installation successful!
- ??
- ==> Migrating /Library/Caches/Homebrew to /Users/qiyuan/Library/Caches/Homebrew.
- ==> Deleting /Library/Caches/Homebrew...
- Already up-to-date.
- ==> Installation successful!
- ==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
- Read the analytics documentation (and how to opt-out) here:
- https://docs.brew.sh/Analytics.html
- ==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
- https://github.com/Homebrew/brew#donations
- ==> Next steps:
- - Run `brew help` to get started
- - Further documentation:
- https://docs.brew.sh
- JHUAN:~ qiyuan$
但是我第一次是失败的, error??
- remote: Enumerating objects: 3, done.
- remote: Counting objects: 100% (3/3), done.
- remote: Compressing objects: 100% (3/3), done.
- error: RPC failed; curl 18 transfer closed with outstanding read data remaining
- fatal: The remote end hung up unexpectedly
- fatal: early EOF
- fatal: index-pack failed
- Failed during: Git fetch origin master:refs/remotes/origin/master --tags --force
- JHUAN:~ qiyuan$
- JHUAN:~ qiyuan$ python
- Python 3.6.5 |Anaconda, Inc.| (default, Apr 26 2018, 08:42:37)
- [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
- Type "help", "copyright", "credits" or "license" for more information.
有网友说是因为 "这个错误是因为项目太久, tag 资源文件太大",(反正我个小白不懂)
解决方案是命令行输入:(后置缓冲器)
Git config --global http.postBuffer 524288000
输入以后没有任何反应, 这时再次重复之前的操作.
- JHUAN:~ qiyuan$ Git config --global http.postBuffer 524288000 #这是刚刚的解决方案
- JHUAN:~ qiyuan$ /usr/bin/Ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" #这个是安装 Homebrew 的命令, 记得把我的名字给删掉啊!!!
- remote: Counting objects: 100% (4865/4865), done.
- remote: Compressing objects: 100% (4653/4653), done.
- remote: Total 4865 (delta 50), reused 868 (delta 21), pack-reused 0
- Receiving objects: 100% (4865/4865), 4.03 MiB | 341.00 KiB/s, done.
- Resolving deltas: 100% (50/50), done.
- Tapped 2 commands and 4650 formulae (4,907 files, 12.6MB).
- ==> Migrating /Library/Caches/Homebrew to /Users/qiyuan/Library/Caches/Homebrew.
- ==> Deleting /Library/Caches/Homebrew...
- Already up-to-date.
- ==> Installation successful!
- ==> Homebrew has enabled anonymous aggregate formulae and cask analytics.
- Read the analytics documentation (and how to opt-out) here:
- https://docs.brew.sh/Analytics.html
- ==> Homebrew is run entirely by unpaid volunteers. Please consider donating:
- https://github.com/Homebrew/brew#donations
- ==> Next steps:
- - Run `brew help` to get started
- - Further documentation:
- https://docs.brew.sh
- JHUAN:~ qiyuan$
这样子就是安装成功了
(2) 使用 Homebrew 安装 python3
brew install python3
(3)terminial 确认 python 和 pip 是否被安装. 直接输入 python3 或者 pip3
python3
(4) 使用 pip3 安装 requests, 直接键入:(其他包同理)
pip3 install requests
(5) 使用 pip3 安装 wheel 库.
pip3 install wheel
使用 pip3 下载 .whl 文件, 完成对 requests 的安装.(但上面那种方法更方便, 在此只是记录对 whl 文件对下载)
pip3 install requests-2.17.3-py2.py3-none-any.whl
来源: http://www.bubuko.com/infodetail-2850209.html