python - 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 或安装其他软件包?
解决方案
它应该是
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))
推荐阅读
- python - google-cloud-storage get_bucket 非常慢
- javascript - 无法将 GeoJSON 从 PostGIS 加载到 Leaflet
- python - 如何在 Python 中输出拟合数据以在 Origin 中使用
- javascript - Google Scripts / Sheets 添加前缀国际电话
- python - py2app“/usr/lib/libstdc++.6.dylib:没有这样的文件或目录”错误
- python-3.x - 如何使用 matplotlib 从数据框中的类标签中添加图例?
- javascript - 更改 ReactPlayer 字幕
- flask - 在heroku上部署烧瓶应用程序的麻烦
- android - Android Kotlin:当应用程序处于打盹模式时获取位置
- react-native - 添加商品时如何添加到购物车?