我在简单的python代码中遇到了'module' object has no attribute 'Vector3'
错误。在
这是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
编译使用:
^{pr2}$得到这个输出:
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文件: https://meep.readthedocs.io/en/latest/Python_Tutorials/Basics/
在ubuntu16.04上使用时也遇到了同样的问题。在
对我有效的方法是为python2.7安装Anaconda,然后使用以下方法创建their recommended environment:
conda create -n mp -c chogan -c defaults -c conda-forge pymeep
之后没有向量3的问题。在
相关问题 更多 >
编程相关推荐