首页 > 解决方案 > Getfem++ 已安装在 Ubuntu 18.04 上,但无法正常工作

问题描述

我在 Ubuntu 18.04 中使用这两行安装了 Python GetFEM++

sudo apt-get update
sudo apt-get install python-getfem++

然后我开始在 Anaconda 上编写代码,

import getfem
m = mesh('cartesian', range(0, 3), range(0,3))

我收到了这个错误:

---------------------------------------------------------------------------
NameError                                 Traceback (most recent call last)
<ipython-input-9-7f9e03c41e63> in <module>
      1 import getfem
----> 2 m = mesh('cartesian', range(0, 3), range(0,3))

NameError: name 'mesh' is not defined

我应该怎么办?是否需要更新 Ubuntu 18.04 或安装其他软件包?

标签: pythonpython-3.xdebianubuntu-18.04

解决方案


它应该是

import getfem
m = getfem.Mesh('cartesian', range(0, 3), range(0,3))

或者

import getfem as gf
m = gf.Mesh('cartesian', range(0, 3), range(0,3))

推荐阅读