我正在使用OSX Yosemite,我在自制软件中安装了import requests
import json
dest = 'https://github.com/timeline.json'
## make the get request and store response
res = requests.get(dest)
## you might want to check if respond code is correct by accessing attribute status_code
## Get the body of the respond as text
body = res.text
## load json string ( text ) into dictionary
res_dict = json.loads(body)
## json is now a dict
assert 'messages' in res_dict
assert 'documentation_url' in res_dict
。
以下程序在编译时失败(例如gcc-4.8
):
gcc-4.8 main.c
错误:
#include <stdio.h>
int main(void)
{
printf("hello world");
return 0;
}
和
main.c:8:19: fatal error: stdio.h: No such file or directory
#include <stdio.h>
^
compilation terminated.
产量
$`gcc-4.8 -print-prog-name=cc1` -v
和
ignoring nonexistent directory "/usr/local/Cellar/gcc48/4.8.4/lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/../../../../../../x86_64-apple-darwin14.3.0/include"
ignoring nonexistent directory "/usr/include"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/Cellar/gcc48/4.8.4/lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/include
/usr/local/include
/usr/local/Cellar/gcc48/4.8.4/include
/usr/local/Cellar/gcc48/4.8.4/lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/include-fixed
/System/Library/Frameworks
/Library/Frameworks
End of search list.
产量
$ find /usr/local/ -name "stdio.h" -print
现在我知道我可以通过/usr/local//Cellar/gcc/5.2.0/include/c++/5.2.0/tr1/stdio.h
/usr/local//Cellar/gcc/5.2.0/lib/gcc/5/gcc/x86_64-apple-darwin14.4.0/5.2.0/include/ssp/stdio.h
/usr/local//Cellar/gcc48/4.8.4/include/c++/4.8.4/tr1/stdio.h
/usr/local//Cellar/gcc48/4.8.4/lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/include/ssp/stdio.h
/usr/local//include/c++/4.8.4/tr1/stdio.h
/usr/local//lib/gcc/4.8/gcc/x86_64-apple-darwin14.3.0/4.8.4/include/ssp/stdio.h
让编译器找到正确的头文件,但为了善良,这是-I /path/to/directory
!我不想为愚蠢的小程序做这件事。我该如何解决这个缺陷?
答案 0 :(得分:1)
我最终删除了brew配方并重新安装。它现在有效,我还不清楚它何时/何时被破坏。
修改强> 事实证明,这个问题已经发生过好几次了。每次升级OSX或Xcode时都会发生这种情况。