在过去,我在Google Colab中使用以下单元安装了pymeep包:
!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.7/site-packages/') 这是该网站的一个完全相同的副本:https://rf5.github.io/2019/12/22/meep-intro.html
有时我写的代码不能工作。它执行时没有错误,但当我尝试执行import meep as mp时。我得到以下错误:
---------------------------------------------------------------------------
ModuleNotFoundError Traceback (most recent call last)
<ipython-input-2-f30f3b609667> in <module>()
----> 1 import meep
ModuleNotFoundError: No module named 'meep'
---------------------------------------------------------------------------
NOTE: If your import is failing due to a missing package, you can
manually install dependencies using either !pip or !apt.
To view examples of installing some common dependencies, click the
"Open Examples" button below.
---------------------------------------------------------------------------有没有更好的方法在Google Colab中安装meep或者pymeep?
发布于 2020-12-13 02:36:29
将3.7替换为3.8,因为使用conda安装的最新python版本为3.8
sys.path.append('/content/anaconda/envs/mp/lib/python3.8/site-packages/') https://stackoverflow.com/questions/65268331
复制相似问题