我正在尝试使用谷歌Colab安装MEEP。
!wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!bash ./Miniconda3-latest-Linux-x86_64.sh -b -p ./anaconda
import os
os.environ['PATH'] += ":/content/anaconda/bin"
!conda create -n mp -c conda-forge pymeep
import sys
sys.path.append('/content/anaconda/envs/mp/lib/python3.8/site-packages/')我从这里复制了代码:https://gist.github.com/venky18/e24df1e55502e2d6523881b3f71c0bff。
然而,结果却是一条错误消息:
/content/anaconda/envs/mp/lib/python3.9/site-packages/meep/_meep.so:未定义符号: PyCMethod_New
如何修改我的代码以正确安装它?
发布于 2021-09-28 10:20:03
来自这里。这项工作目前正在进行:
!wget -c https://repo.continuum.io/miniconda/Miniconda3-latest-Linux-x86_64.sh
!chmod +x Miniconda3-latest-Linux-x86_64.sh
!bash ./Miniconda3-latest-Linux-x86_64.sh -b -u -p /usr/local
import os
if os.path.isdir('/content/anaconda'): root_path = '/content/anaconda'
else: root_path = '/usr/local/'
os.environ['PATH'] += f":{root_path}/bin"
!conda create -n mp -c conda-forge pymeep python=3.7 -y
print(">> ", root_path)
import sys
sys.path.append(f'{root_path}envs/mp/lib/python3.7/site-packages/')我认为您链接的代码片段的问题是,当前colab的默认版本是3.7.12。Conda现在默认为3.8。尝试在3.7安装中使用3.8安装的软件包是自找麻烦。将python=3.7添加到create行强制conda使用python3.7,因此安装了正确的包。
https://stackoverflow.com/questions/68729015
复制相似问题