【记录】Apple M1 python安装open3d

先说结论,Apple M1 安装python3.8+open3d 15.0.1
pip install open3d==0.15.1

pip install open3d

因为一开始在linux上安装open3d的时候python3.9发现有package不兼容,因此选择安装在python3.7版本上。但是python3.7和Apple M1芯片貌似不兼容。
因此选择python3.8的anaconda环境。

第一次使用了pip install open3d,安装的是open3d 0.17.0版本。但是在尝试代码的时候出现报错

Traceback (most recent call last):
  File "open3d.py", line 2, in <module>
    import open3d as o3d
  File "open3d.py", line 8, in <module>
    mesh = o3d.geometry.TriangleMesh.create_sphere()
AttributeError: partially initialized module 'open3d' has no attribute 'geometry' (most likely due to a circular import)

其实是因为文件名不能和函数同名。

pip install open3d-python

第二次按照网上教程安装open3d-python: pip install open3d-python ,报错

Traceback (most recent call last):
  File "tryopen3d.py", line 2, in <module>
    import open3d as o3d
  File "/Users/chenchen/anaconda3/envs/3d/lib/python3.8/site-packages/open3d/__init__.py", line 11, in <module>
    from open3d.macos import *
  File "/Users/chenchen/anaconda3/envs/3d/lib/python3.8/site-packages/open3d/macos/__init__.py", line 7, in <module>
    globals().update(importlib.import_module('open3d.macos.open3d').__dict__)
  File "/Users/chenchen/anaconda3/envs/3d/lib/python3.8/importlib/__init__.py", line 127, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
ImportError: dlopen(/Users/chenchen/anaconda3/envs/3d/lib/python3.8/site-packages/open3d/macos/open3d.so, 0x0002): tried: '/Users/chenchen/anaconda3/envs/3d/lib/python3.8/site-packages/open3d/macos/open3d.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), '/System/Volumes/Preboot/Cryptexes/OS/Users/chenchen/anaconda3/envs/3d/lib/python3.8/site-packages/open3d/macos/open3d.so' (no such file), '/Users/chenchen/anaconda3/envs/3d/lib/python3.8/site-packages/open3d/macos/open3d.so' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64'))

安装的版本是open3d-python 0.3.0.0,可能是版本和芯片不兼容。遂pip uninstall open3d-python

pip install open3d

第三次使用pip install open3d
结果报错

Traceback (most recent call last):
  File "tryopen3d.py", line 2, in <module>
    import open3d as o3d
  File "/Users/chenchen/anaconda3/envs/3d/lib/python3.8/site-packages/open3d/__init__.py", line 93, in <module>
    from open3d.cpu.pybind import (core, camera, data, geometry, io, pipelines,
ImportError: dlopen(/Users/chenchen/anaconda3/envs/3d/lib/python3.8/site-packages/open3d/cpu/pybind.cpython-38-darwin.so, 0x0002): Library not loaded: /opt/homebrew/opt/libomp/lib/libomp.dylib
  Referenced from: <A2C68595-9594-3758-BEFB-86BA2C701093> /Users/chenchen/anaconda3/envs/3d/lib/python3.8/site-packages/open3d/cpu/pybind.cpython-38-darwin.so
  Reason: tried: '/opt/homebrew/opt/libomp/lib/libomp.dylib' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/opt/homebrew/opt/libomp/lib/libomp.dylib' (no such file), '/opt/homebrew/opt/libomp/lib/libomp.dylib' (no such file), '/usr/local/lib/libomp.dylib' (no such file), '/usr/lib/libomp.dylib' (no such file, not in dyld cache)

可能还是版本问题。

pip install open3d==0.15.1

最后一次安装pip install open3d==0.15.1,就可以正常运行了。

猜你喜欢

转载自blog.csdn.net/yaoyao_chen/article/details/130734910