在Python 3.9.7中导入torch_geometric时出错

tcomlyy6  于 2023-01-11  发布在  Python
关注(0)|答案(1)|浏览(363)

我尝试在conda环境中安装torch_geometric,但每次尝试安装时都出现以下错误:

import torch_geometric

错误:

OSError: dlopen(/Users/psanchez/miniconda3/envs/playbook/lib/python3.9/site-packages/libpyg.so, 0x0006): Library not loaded: /usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/Python
  Referenced from: <95F9BBA5-21FB-3EA5-9028-172B745E6ABA> /Users/psanchez/miniconda3/envs/playbook/lib/python3.9/site-packages/libpyg.so
  Reason: tried: '/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/System/Volumes/Preboot/Cryptexes/OS/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/usr/local/opt/python@3.10/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/Library/Frameworks/Python.framework/Versions/3.10/Python' (no such file), '/System/Library/Frameworks/Python.framework/Versions/3.10/Python' (no such file, not in dyld cache)

这是我如何安装conda环境:

onda create --name playbook python=3.9.7  --no-default-packages
conda activate playbook

pip install torch==1.13.1 torchvision==0.14.1

pip install pyg-lib torch-scatter torch-sparse torch-cluster torch-spline-conv torch-geometric -f https://data.pyg.org/whl/torch-1.13.0+cpu.html

知道如何解决这个错误吗?
提前感谢!

pexxcrt2

pexxcrt21#

如果你检查你的错误信息,在“引用自”行你可以看到Python版本3. 9,但在“原因尝试”行,你有Python版本3. 10。
所以我认为你正在用Python 3.10和Python 3.9或者相反的环境,你应该干净地重新创建你的环境。

相关问题