macOS pthread 未找到

问题描述 投票:0回答:1

所以我正在尝试运行一个名为 COMMIT2 的框架(纤维束成像过滤,它的作用并不重要),当运行他们的教程数据时运行良好,但是当运行我自己的数据时(我猜它使用了另一个函数)给出了一个错误。错误发生在调用以下内容的脚本中:

" #include <pthread.h> " 
Error: /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/commit/operator/operator_withLUT.c:1:10: fatal error: 'pthread.h' file not found #include <pthread.h> ^~~~~~~~~~~ 1 error generated. 

它还提供了一个非常大的回溯,我将在下面包含它(但据我所知,主要问题是在 pthread 中未找到)我在 macbook 上,无法真正找到任何真正的类似问题和/或修复在线,所以如果有人可以帮助我,我将非常感激!

----------------- Traceback: Traceback (most recent call last): File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/unixccompiler.py", line 185, in _compile self.spawn(compiler_so + cc_args + [src, '-o', obj] + extra_postargs) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/ccompiler.py", line 1041, in spawn spawn(cmd, dry_run=self.dry_run, **kwargs) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/spawn.py", line 70, in spawn raise DistutilsExecError( distutils.errors.DistutilsExecError: command '/usr/local/fsl/bin/clang' failed with exit code 1 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 314, in create_module so_path = build_module(spec.name, pyxfilename=spec.origin, pyxbuild_dir=self._pyxbuild_dir, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 197, in build_module so_path = pyxbuild.pyx_to_dll(pyxfilename, extension_mod, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyxbuild.py", line 103, in pyx_to_dll dist.run_commands() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/dist.py", line 963, in run_command super().run_command(command) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run self.build_extensions() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 135, in build_extension super(build_ext, self).build_extension(ext) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension objects = self.compiler.compile( File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/ccompiler.py", line 600, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile raise CompileError(msg) distutils.errors.CompileError: command '/usr/local/fsl/bin/clang' failed with exit code 1 During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/bkalkhov/Tractography/Tractography_performance_testing/Tests/Commit2test/Own_data/test.py", line 60, in <module> mit.build_operator() File "commit/core.pyx", line 763, in commit.core.Evaluation.build_operator File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 332, in create_module raise exc.with_traceback(tb) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 314, in create_module so_path = build_module(spec.name, pyxfilename=spec.origin, pyxbuild_dir=self._pyxbuild_dir, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/_pyximport3.py", line 197, in build_module so_path = pyxbuild.pyx_to_dll(pyxfilename, extension_mod, File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/pyximport/pyxbuild.py", line 103, in pyx_to_dll dist.run_commands() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/dist.py", line 969, in run_commands self.run_command(cmd) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/dist.py", line 963, in run_command super().run_command(command) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/dist.py", line 988, in run_command cmd_obj.run() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 345, in run self.build_extensions() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 467, in build_extensions self._build_extensions_serial() File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 493, in _build_extensions_serial self.build_extension(ext) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/Cython/Distutils/build_ext.py", line 135, in build_extension super(build_ext, self).build_extension(ext) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/command/build_ext.py", line 548, in build_extension objects = self.compiler.compile( File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/ccompiler.py", line 600, in compile self._compile(obj, src, ext, cc_args, extra_postargs, pp_opts) File "/Users/bkalkhov/Library/Python/3.10/lib/python/site-packages/setuptools/_distutils/unixccompiler.py", line 187, in _compile raise CompileError(msg) ImportError: Building module commit.operator.operator failed: ["distutils.errors.CompileError: command '/usr/local/fsl/bin/clang' failed with exit code 1\n"]
python c++ macos pthreads cython
1个回答
0
投票

从回溯看来,您正在使用的框架正在使用自带的编译器(

/usr/local/fsl/bin/clang
),并且当您调用时,它正在尝试构建用 C 编写的 Python 扩展(大概是在后台执行繁重的工作)它。

<pthread.h>
是任何 POSIX 类系统(例如 macOS、Linux)上的系统标头,事实上它找不到它,这表明您没有安装 macOS 系统的任何系统标头,并且你将无法在你的系统上编译任何重要的C程序。

我不知道你的具体框架以及它的内部设计方式,但是你可以尝试安装XCode Command Line Tools(甚至完整的XCode开发环境),以便在你的系统上安装系统头文件。我不知道与您正在使用的框架一起提供的自定义编译器是否能够自动找到它们。

注意:你需要一个Apple ID才能通过Apple网站下载XCode,但你也可以在没有Apple id的情况下通过其他方式安装它,我知道的最简单的方法是安装Homebrew,它会自动安装XCode CLI工具.

© www.soinside.com 2019 - 2024. All rights reserved.