一、在mac笔记本上安装python3
brew install python3
二、在mac笔记本上安装pip3
在做Python开发时,通常需要使用pip3进行进行其他Python包的安装,默认是Python3自带了pip3,但是通常不能够直接启动pip3,所以需要手动来进行pip3的安装,步骤如下:
-
首先,进入下面链接,下载需要的Python脚本文件:
执行命令:
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py下载得到
get-pip.py文件。 -
其次,执行
get-pip.py文件脚本:python3 get-pip.py- 之后显示信息:
Collecting pip
Using cached https://files.pythonhosted.org/packages/c2/d7/90f34cb0d83a6c5631cf71dfe64cc1054598c843a92b400e55675cc2ac37/pip-18.1-py2.py3-none-any.whl
Collecting setuptools
Downloading https://files.pythonhosted.org/packages/e7/16/da8cb8046149d50940c6110310983abb359bbb8cbc3539e6bef95c29428a/setuptools-40.6.2-py2.py3-none-any.whl (573kB)
100% |████████████████████████████████| 573kB 639kB/s
Collecting wheel
Downloading https://files.pythonhosted.org/packages/ff/47/1dfa4795e24fd6f93d5d58602dd716c3f101cfd5a77cd9acbe519b44a0a9/wheel-0.32.3-py2.py3-none-any.whl
Installing collected packages: pip, setuptools, wheel
The script wheel is installed in ‘/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/bin’ which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed pip-18.1 setuptools-40.6.2 wheel-0.32.3pip3命令依然无法执行。
-
最后,为在python 3的Frameworks目录下的bin目录下进行pip3在mac上建立软链:
ln -s /usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/bin/pip3 /usr/local/bin/这里的
/usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/bin/pip3需要根据自己的电脑环境进行指定。
之后执行命令验证pip3正确安装:pip3 -Vpip 18.1 from /usr/local/Cellar/python3/3.6.4_2/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip (python 3.6)
本文档详细介绍了如何在Mac上安装Python3和pip3。通过下载get-pip.py脚本并执行,成功安装了pip3,但在安装过程中提示警告。为了解决pip3无法直接执行的问题,文章提供了在Python 3的Frameworks目录下为pip3创建软链接的步骤,并通过验证确认pip3已正确安装。

2359

被折叠的 条评论
为什么被折叠?



