我已经使用anaconda环境安装了pymeep。不幸的是,当我使用Spyder尝试运行时,使用meep的Vector3类出现错误:
AttributeError:模块'meep'没有属性'Vector3'
有人知道如何解决吗?我已经尝试使用推荐的环境:
conda create -n mp -c chogan -c defaults -c conda-forge pymeep
不使用。
我使用的代码是here:
中的第一个教程/示例import meep as mp
cell = mp.Vector3(16, 8, 0)
geometry = [mp.Block(mp.Vector3(1e20, 1, 1e20),
center=mp.Vector3(0, 0),
material=mp.Medium(epsilon=12))]
sources = [mp.Source(mp.ContinuousSource(frequency=0.15),
component=mp.Ez,
center=mp.Vector3(-7,0))]
pml_layers = [mp.PML(1.0)]
resolution = 10
sim = mp.Simulation(cell_size=cell,
boundary_layers=pml_layers,
geometry=geometry,
sources=sources,
resolution=resolution)
sim.run(until=200)
答案 0 :(得分:0)
我遇到了同样的问题,一旦我开始使用python2而不是python3,一切都会正常工作。