在macOS上的python 2.7上安装rpy2
我在macOS High Sierra上有python版本2.7.10,希望安装rpy2 当我做sudopip安装rpy2时 我收到错误消息:在macOS上的python 2.7上安装rpy2,macos,python-2.7,clang,openmp,rpy2,Macos,Python 2.7,Clang,Openmp,Rpy2,我在macOS High Sierra上有python版本2.7.10,希望安装rpy2 当我做sudopip安装rpy2时 我收到错误消息: Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-Nwbha3/rpy2/ clang: error: unsupported option '-fopenmp' clang: error: unsupported option '
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-Nwbha3/rpy2/
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-O0cu4E-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-haDUA3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-O0cu4E-build/
我已经升级了setuptools(版本39.0.1)
我还下载了旧版本rpy2-2.7.0.tar.gz,并尝试使用sudo pip install rpy2-2.7.0.tar.gz安装它。然后,我收到以下错误消息:
Command "python setup.py egg_info" failed with error code 1 in /private/tmp/pip-build-Nwbha3/rpy2/
clang: error: unsupported option '-fopenmp'
clang: error: unsupported option '-fopenmp'
error: command 'cc' failed with exit status 1
----------------------------------------
Command "/usr/bin/python -u -c "import setuptools, tokenize;__file__='/private/tmp/pip-O0cu4E-build/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-haDUA3-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/tmp/pip-O0cu4E-build/
如果有人能解答我的安装问题,我将不胜感激。
非常感谢 Mac附带的
clang
不支持openmp
,这正是-fopenmp
标志的作用。您可能需要一个支持openmp的clang版本
一个可能的解决方案是使用openmp支持获得完整的llvm/clang构建。使用自制软件,您可以:
brew install llvm # clang/llvm
brew install libomp # OpenMP support
然后用新安装的clang版本再次尝试安装rpy2
例如,当前版本是6.0.0
,因此您可以运行
CC=/usr/local/Cellar/llvm/6.0.0/bin/clang pip install rpy2
您使用的是哪一版本的pip?Mac附带的
clang
不支持openmp
,这正是-fopenmp
标志的作用所在。我的pip版本是9.0.3。很快,二进制软件包将可用,以便安装再次开箱即用。以下是相关问题:请注意,此过程链接到由Homebrew安装的libomp
。如果您想链接到官方R框架附带的lib,请参阅BItBucket问题。