无法使用 icc 编译器在 Ubuntu 14.04 上安装 h5py

Unable to install h5py on Ubuntu 14.04 with icc compiler

我正在尝试使用以下命令

在 Ubuntu 14.04 上安装 netcdf4 软件包

pip3 安装 netcdf4

这确实安装成功,但是当我尝试执行导入 netCDF4 的脚本时,出现以下错误 -

Traceback (most recent call last):
File "display.py", line 5, in <module>
from netCDF4 import Dataset  # http://code.google.com/p/netcdf4-python/
File "/usr/local/lib/python3.4/dist-packages/netCDF4/__init__.py", line 3, in <module> from ._netCDF4 import *
File "netCDF4/_netCDF4.pyx", line 942, in init netCDF4._netCDF4 (netCDF4/_netCDF4.c:76006)
File "/usr/local/lib/python3.4/dist-packages/netcdftime/__init__.py", line 1, in <module>
from .netcdftime import utime, JulianDayFromDate, DateFromJulianDay
File "/usr/local/lib/python3.4/dist-packages/netcdftime/netcdftime.py",   line 14, in <module>
from ._datetime import datetime 
ImportError: /usr/local/lib/python3.4/dist-packages/netcdftime/_datetime.cpython-34m.so: undefined symbol: __intel_sse2_strchr

所以看起来这对 cython 和 hdf5 有依赖性。 我确实安装了 cython,并且安装成功。

当我执行 pip3 install h5py 时,出现以下错误 -

有什么建议吗?我正在使用 Intel icc 编译器,无法切换到 gcc。

Traceback (most recent call last):

File "<string>", line 1, in <module>

File "/tmp/pip_build_root/h5py/setup.py", line 149, in <module>

cmdclass = CMDCLASS,

File "/usr/lib/python3.4/distutils/core.py", line 148, in setup

dist.run_commands()

File "/usr/lib/python3.4/distutils/dist.py", line 955, in run_commands

self.run_command(cmd)

File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

cmd_obj.run()

File "/usr/lib/python3/dist-packages/setuptools/command/install.py", line 53, in run

return _install.run(self)

File "/usr/lib/python3.4/distutils/command/install.py", line 583, in run

self.run_command('build')

File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command

self.distribution.run_command(command)

File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

cmd_obj.run()

File "/usr/lib/python3.4/distutils/command/build.py", line 126, in run

self.run_command(cmd_name)

File "/usr/lib/python3.4/distutils/cmd.py", line 313, in run_command

self.distribution.run_command(command)

File "/usr/lib/python3.4/distutils/dist.py", line 974, in run_command

cmd_obj.run()

File "/tmp/pip_build_root/h5py/setup_build.py", line 147, in run

from Cython.Build import cythonize

File "/usr/local/lib/python3.4/dist-packages/Cython/Build/__init__.py", line 1, in <module>

from .Dependencies import cythonize

File "/usr/local/lib/python3.4/dist-packages/Cython/Build/Dependencies.py", line 50, in <module>

from ..Compiler.Main import Context, CompilationOptions, default_options

File "/usr/local/lib/python3.4/dist-packages/Cython/Compiler/Main.py", line 28, in <module>

from .Scanning import PyrexScanner, FileSourceDescriptor

 ImportError/usr/local/lib/python3.4/distpackages/Cython/Compiler/Scanning.cpython-34m.so: undefined symbol: __intel_sse2_strchr

最初:

  sudo apt-get update
  sudo apt-get install build-essential  # that should get you the right gcc
  sudo apt-get install python3-setuptools
  sudo apt-get install python3-dev
  sudo apt-get install python3-lxml

然后通过 apt-get 安装 pip3 - 验证你的 pip 是否与 Ubuntu:

一致
 apt-get install python-pip3
 apt-get install python3-h5py

然后是任何其他模块