Macports 拒绝安装 python 2.7.6.0

Macports 拒绝安装 python 2.7.6.0

我正在尝试升级使用 MacPorts 安装的各种程序。不幸的是,python 拒绝升级:

--->  Computing dependencies for python27
--->  Configuring python27
Error: Failed to configure python27, consult /opt/local/var/macports/build/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/work/Python-2.7.6/config.log
Error: org.macports.configure for port python27 returned: configure failure: command execution failed
Please see the log file for port python27 for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_tarballs_ports_lang_python27/python27/main.log
Error: Unable to upgrade port: 1
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets

main.log文件仅包含 的输出./configure,这没有任何帮助,只是表明未找到 IPV6 支持。但是,config.log有以下部分:

configure:11358: checking for getaddrinfo
configure:11376: /usr/bin/clang -o conftest -arch x86_64 -arch i386 -pipe -Os -fwrapv -arch x86_64 -arch i386 -I/opt/local/include -I/opt/local/include/db46 -arch x86_64 -arch i386 -isysroot / -L/opt/local/lib -Wl,-headerpad_max_install_names -L/opt/local/lib/db46 -arch x86_64 -arch i386 conftest.c -ldl  >&5
conftest.c:221:10: fatal error: 'sys/types.h' file not found
#include <sys/types.h>
         ^
1 error generated.

失败的程序是:

#include <sys/types.h>
#include <sys/socket.h>
#include <netdb.h>
#include <stdio.h>

int
main ()
{
getaddrinfo(NULL, NULL, NULL, NULL);
  ;
  return 0;
}

这段代码编译失败是因为sys/types.h没有找到,而不是getaddrinfo不存在。当我把这段程序粘贴到一个文件中时,C 编译器成功编译了它。

发生了什么事?我能做什么?

答案1

您使用的是最新版本的 MacPorts 吗?他们已经提供二进制包一段时间了。我会先升级,然后卸载 python27,然后重新安装。

sudo port selfupdate
sudo port -f uninstall python27
sudo port clean python
sudo port install python
sudo port -uc upgrade outdated

我刚刚在安装时执行了此操作,它安装了二进制包,无需编译。

至于您收到的实际错误,我会检查 XCode CLI 工具是否全部安装;ls -lah /usr/include/sys/types.h应该会给您一个文件。如果没有,请尝试xcode-select --install

相关内容