mac brew 安装pip3,Installing with get-pip.py

本文档详细介绍了如何在Mac上安装Python3和pip3。通过下载get-pip.py脚本并执行,成功安装了pip3,但在安装过程中提示警告。为了解决pip3无法直接执行的问题,文章提供了在Python 3的Frameworks目录下为pip3创建软链接的步骤,并通过验证确认pip3已正确安装。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

一、在mac笔记本上安装python3

brew install python3

二、在mac笔记本上安装pip3

在做Python开发时,通常需要使用pip3进行进行其他Python包的安装,默认是Python3自带了pip3,但是通常不能够直接启动pip3,所以需要手动来进行pip3的安装,步骤如下:

Requirement already satisfied: setuptools>=0.7 in ./.venv/lib/python3.9/site-packages (from APScheduler==3.7.0->-r requirements.txt (line 4)) (80.9.0) Requirement already satisfied: gevent in ./.venv/lib/python3.9/site-packages (from grequests==0.6.0->-r requirements.txt (line 40)) (25.5.1) Requirement already satisfied: numpy>=1.15.4 in ./.venv/lib/python3.9/site-packages (from pandas==1.1.5->-r requirements.txt (line 58)) (2.0.2) Requirement already satisfied: scikit-learn in ./.venv/lib/python3.9/site-packages (from sklearn==0.0->-r requirements.txt (line 79)) (1.6.1) INFO: pip is looking at multiple versions of gevent to determine which version is compatible with other requirements. This could take a while. Collecting gevent (from grequests==0.6.0->-r requirements.txt (line 40)) Downloading gevent-25.4.2.tar.gz (6.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.3/6.3 MB 10.8 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Downloading gevent-25.4.1.tar.gz (6.3 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.3/6.3 MB 7.4 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Downloading gevent-24.11.1.tar.gz (6.0 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.0/6.0 MB 11.8 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Downloading gevent-24.10.3.tar.gz (6.1 MB) ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 6.1/6.1 MB 7.4 MB/s eta 0:00:00 Installing build dependencies ... done Getting requirements to build wheel ... error error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> [39 lines of output] Compiling src/gevent/resolver/cares.pyx because it changed. [1/1] Cythonizing src/gevent/resolver/cares.pyx Error compiling Cython file: ------------------------------------------------------------ ... cdef tuple integer_types if sys.version_info[0] >= 3: integer_types = int, else: integer_types = (int, long) ^ ------------------------------------------------------------ src/gevent/libev/corecext.pyx:69:26: undeclared name not builtin: long Compiling src/gevent/libev/corecext.pyx because it changed. [1/1] Cythonizing src/gevent/libev/corecext.pyx Traceback (most recent call last): File "/Users/didi/code/doraemon-api/.venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module> main() File "/Users/didi/code/doraemon-api/.venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main json_out["return_val"] = hook(**hook_input["kwargs"]) File "/Users/didi/code/doraemon-api/.venv/lib/python3.9/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 143, in get_requires_for_build_wheel return hook(config_settings) File "/private/var/folders/cf/1231crpx4hsf3vf_6wtb6ybw0000ks/T/pip-build-env-i9_0xwq3/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 331, in get_requires_for_build_wheel return self._get_build_requires(config_settings, requirements=[]) File "/private/var/folders/cf/1231crpx4hsf3vf_6wtb6ybw0000ks/T/pip-build-env-i9_0xwq3/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 301, in _get_build_requires self.run_setup() File "/private/var/folders/cf/1231crpx4hsf3vf_6wtb6ybw0000ks/T/pip-build-env-i9_0xwq3/overlay/lib/python3.9/site-packages/setuptools/build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 54, in <module> File "/private/var/folders/cf/1231crpx4hsf3vf_6wtb6ybw0000ks/T/pip-install-p6p1o97m/gevent_804a446da2d9472bb3cfb9a391265401/_setuputils.py", line 249, in cythonize1 new_ext = cythonize( File "/private/var/folders/cf/1231crpx4hsf3vf_6wtb6ybw0000ks/T/pip-build-env-i9_0xwq3/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1154, in cythonize cythonize_one(*args) File "/private/var/folders/cf/1231crpx4hsf3vf_6wtb6ybw0000ks/T/pip-build-env-i9_0xwq3/overlay/lib/python3.9/site-packages/Cython/Build/Dependencies.py", line 1298, in cythonize_one raise CompileError(None, pyx_file) Cython.Compiler.Errors.CompileError: src/gevent/libev/corecext.pyx [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: subprocess-exited-with-error × Getting requirements to build wheel did not run successfully. │ exit code: 1 ╰─> See above for output. note: This error originates from a subprocess, and is likely not a problem with pip.
06-17
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值