在High Sierra使用pip安装vpython

时间:2018-01-31 15:47:48

标签: pip macos-high-sierra vpython

我在使用vpython安装pip时遇到问题。在安装过程中,我得到了错误,好像我没有stdio.h,我做了

In file included from _scandir.c:14:
/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/Python.h:33:10: fatal error: 'stdio.h' file not found
#include <stdio.h>
         ^~~~~~~~~
1 error generated.
error: command '/usr/bin/clang' failed with exit status 1


Command "/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -u -c "import setuptools, tokenize;__file__='/private/var/folders/mf/h7c_zhyd7yl6t7nkgx10j6pw0000gq/T/pip-build-czavCr/scandir/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/mf/h7c_zhyd7yl6t7nkgx10j6pw0000gq/T/pip-is5WM1-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/mf/h7c_zhyd7yl6t7nkgx10j6pw0000gq/T/pip-build-czavCr/scandir/

我正在运行High Sierra,最新的Xcode

网上的大多数帖子都建议安装命令行工具 xcode-select --install但我做了,我可以编译我的一些代码就好了。 我尝试过的其他事情:

  1. 删除并重新安装xcode +命令行工具
  2. 删除/Library/Developer/CommandLineTools/
  3. CFLAGS=-stdlib=libc++ pip install vpython
  4. MACOSX_DEPLOYMENT_TARGET=10.13 pip install vpython
  5. 但没有任何作用。我完全没有想法

1 个答案:

答案 0 :(得分:0)

我无法理解上面的问题,但我找到了两个解决方法来获得vpython的工作版本。不知何故,这个问题似乎与我从python.org安装的python包有关,包括pip。我删除它并使用Homebrew安装python2和python3,pip2和pip3都成功安装了vpython和其他模块。

另一个替代方案,似乎更好的是安装Anaconda Python然后使用conda来获取vphyton。