安装 Virtualenv install 时出现 locustio error 1

When installing Virtualenv install I get locustio error 1

我是 运行 virtualenv python 3.6,我正在尝试加载测试 django 应用程序。在它之前成功安装所有依赖项后,我收到以下错误。

Installing collected packages: greenlet, gevent, locustio
  Running setup.py install for greenlet ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-install-lrm7ibd5/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/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-record-77exz0iu/install-record.txt --single-version-externally-managed --compile:
    running install
    running build
    running build_ext
    building 'greenlet' extension
    creating build
    creating build/temp.macosx-10.6-intel-3.6
    gcc -fno-strict-aliasing -Wsign-compare -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -arch i386 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c greenlet.c -o build/temp.macosx-10.6-intel-3.6/greenlet.o
    xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
    error: command 'gcc' failed with exit status 1

----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-install-lrm7ibd5/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/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-record-77exz0iu/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/3t/_nx5hykn0hsfs5v1x_svhdym0000gn/T/pip-install-lrm7ibd5/greenlet/

运行 在终端 xcode-select --install 这将安装 xcode 命令行工具(不是 xcode 本身),您将被要求输入密码并同意许可证。

发生这种情况是因为一个(或多个)包包含需要编译的 C 扩展,并且编译需要 xcode 命令行工具。

一个单独的解决方案是安装 Anaconda python,如果您不需要科学包 python,miniconda,这个 python 发行版包括一个包管理器 (conda)工作起来很像 pip,但具有预编译包的优势