【问题标题】:How to properly download a Python module (xlwings) on mac terminal?如何在 mac 终端上正确下载 Python 模块(xlwings)?
【发布时间】:2019-07-05 03:38:50
【问题描述】:

我一直在尝试从终端安装 xlwings 模块(在 python 3.7 上)并遇到一些错误。在最后一次尝试中,当我输入 pip3 install xlwings 时,我收到以下错误。

gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -DPSUTIL_POSIX=1 -DPSUTIL_VERSION=550 -DPSUTIL_OSX=1 -I/Library/Frameworks/Python.framework/Versions/3.7/include/python3.7m -c psutil/_psutil_common.c -o build/temp.macosx-10.9-x86_64-3.7/psutil/_psutil_common.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

命令 "/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -u -c "import setuptools, tokenize;file='/private/var/folders/ b_/kf3zc0xx3f51rbjcj5gcd9lh0000gn/T/pip-install-qo2pickz/psutil/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/b_/kf3zc0xx3f51rbjcj5gcd9lh0000gn/T/pip-record-vpk41akr/install-record.txt --single-version-externally-managed --compile" 失败,错误代码 1 在 /private/var/folders/b_/kf3zc0xx3f51rbjcj5gcd9lh0000gn/ T/pip-install-qo2pickz/psutil/

我对终端一无所知,但愿意学习。你有什么建议吗? 提前致谢!

【问题讨论】:

  • 或者,您可以安装 git bash,它为您提供 mac/linux 风格的终端

标签: python python-3.7 xlwings


【解决方案1】:

我相信您需要下载并安装 xcode 开发人员工具(您不需要完整的 xcode 安装)。它应该可以解决问题。有关详细信息,请参阅 related question 上的 this answer

【讨论】:

  • 感谢彼得的建议。它确实有效,我设法安装了 xlwings。但是现在我在我的外壳中遇到了上述错误:/ Traceback(最近一次调用最后一次):文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/xlwings-0.15.2- py3.7.egg/xlwings/_xlmac.py",第 10 行,在 中 import aem ModuleNotFoundError: No module named 'aem'
  • 再次执行pip install appscript。最好先做pip uninstall appscript。 Wheels 现在可以在 pypi 上使用,因此安装应该不再是问题。
  • 不幸的是它没有工作。我也尝试使用 conda,但仍然“没有名为 'aem' 的模块”。我已经安装了许多模块,而在另一台设备上没有遇到错误。问题可能是我使用的是 mojave,不能吗?
  • @EvrimOzanYılmaz 当您说您尝试过 conda 时,您的意思是安装完整的 xlwings,还是只安装 aem。如果只是 aem 可能尝试通过 conda 安装所有 xlwings:anaconda.org/anaconda/xlwings
  • 我已经像在网站上一样安装了所有 xlwings 但仍然收到错误 no module named aem :/ 我也下载了 xcode 并且仍然一样。
猜你喜欢
  • 1970-01-01
  • 2020-02-22
  • 1970-01-01
  • 1970-01-01
  • 2017-05-31
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-08-03
相关资源
最近更新 更多