Vector3 in Meep in Python

问题描述:

我在我的简单Python代码中得到'module' object has no attribute 'Vector3'错误。Vector3 in Meep in Python

这是rightAngle.py文件

import meep as mp 
import math 

cell = mp.Vector3(16, 8, 0) 
geometry = [mp.Bloack(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 

使用Compling:

python rightAngle.py >& rightAngle.out 

并得到这样的输出:

Traceback (most recent call last): 
    File "rightAngle.py", line 4, in <module> 
    cell = mp.Vector3(16, 8, 0) 
AttributeError: 'module' object has no attribute 'Vector3' 

我做的是给定的代码复制并粘贴此相当可靠source但在Vector3对象中出现错误。

Python版本:

Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2 

我不知道我错过了什么?

MEEP文件:试图用它在Ubuntu 16.04 https://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/

+0

我已经尝试了许多相关的解决方案,但没有运气。 – Rahul

+0

“meep”文档在哪里? 'Vector3'? – hpaulj

+0

@hpaulj我已经添加了Meep文档源。 – Rahul

得到了同样的问题。之后

conda create -n mp -c chogan -c defaults -c conda-forge pymeep

的Vector3无问题:

什么工作对我来说是为Python 2.7版安装Anaconda和使用创造their recommended environment