我正在尝试在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","credits" or "license" for more information.
我假设python3 -m pip install watchdog
会导致编译错误,因为Python 3没有使用GCC。该错误消息很长,可以在这里找到:https://pastebin.com/DEAKANQ9
在我的$ PATH中,/usr/local/bin
之前有gcc
(已安装/usr/bin
),即
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?