【发布时间】:2020-03-12 09:41:56
【问题描述】:
我正在尝试在我的 Mac (MacOS 10.14.6 Mojave) 上制作 Python 脚本,但在安装模块(看门狗)时遇到了麻烦。我有内置的 Python 2,我用 Homebrew 安装了 Python 3。
如果终端python中的类型,我得到:
Python 2.7.16 (default, Oct 16 2019, 00:34:56)
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
所以 Python 2 正确地使用了 GCC(Apple 提供的那个?我不确定)而不是 Clang。现在,如果我这样做 python -m pip install watchdog 它就可以了。但我想在 Python 3 上安装模块,由于某种原因使用 Clang 而不是 GCC。事实上,如果我输入 `python3',我会得到:
Python 3.8.0 (v3.8.0:fa919fdf25, Oct 14 2019, 10:23:27)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
我认为python3 -m pip install watchdog 会导致编译错误,因为 Python 3 没有使用 GCC。错误信息很长,可以在这里找到:https://pastebin.com/DEAKANQ9
在我的 $PATH 中,/usr/bin 之前有/usr/local/bin(安装了gcc),即
echo $PATH
/Library/Frameworks/Python.framework/Versions/3.8/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin
我会说一切都设置正确,但显然情况并非如此。如何让 Python 3 使用 GCC 而不是 Clang?
【问题讨论】:
标签: python python-3.x macos gcc clang