2017-10-21 236 views
0

我在我的簡單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

回答

1

得到了同樣的問題。之後

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

的Vector3無問題:

什麼工作對我來說是爲Python 2.7版安裝Anaconda和使用創造their recommended environment