MacOS python3 安装 gevent 模块

使用 TPscan 时需要安装 Python3 的 gevent 模块

环境

系统版本:MacOS 10.15.7

Python 版本:3.8.2

问题描述

先尝试使用下面命令安装:

1
2
pip3 install gevent
python3 -m pip install gevent

报错信息如下:

1
2
3
---------------------------------------------
ERROR: Command errored out with exit status 1: /Applications/Xcode.app/Contents/Developer/usr/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/tmp/pip-install-d7edx1ek/greenlet/setup.py'"'"'; __file__='"'"'/private/tmp/pip-install-d7edx1ek/greenlet/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/tmp/pip-record-sr9i1xr3/install-record.txt --single-version-externally-managed --compile --install-headers /Library/Python/3.8/include/greenlet Check the logs for full command output.

产生原因

MAC OS的Xcode从5.1起给编译器规定对于未知参数传入视为error,我们需要使用ARCHFLAGS将该error降级为warning。

解决办法

大哥 @matrix 在10月27号晚上找到了解决这个困扰我们好几天的报错的办法:

1
sudo ARCHFLAGS=-Wno-error=unused-command-line-argument-hard-error-in-future pip3 install gevent

完美解决 一键安装

image-20201028234532695

安装成功后再次尝试 pyhton3 TPscan.py 成功:

image-20201028235228646

参考链接:https://blog.csdn.net/qq_34081968/article/details/109100499