【问题标题】:How to use FEniCS in Jupyter Notebook or Spyder?如何在 Jupyter Notebook 或 Spyder 中使用 FEniCS?
【发布时间】:2017-02-04 05:41:51
【问题描述】:

我最近使用 Docker 通过以下命令安装了 FEniCS

Terminal> curl -s https://get.fenicsproject.org | bash

当我在fenicsproject 会话中时,一切都运行良好。在此会话中,当我使用 which python 时,我得到以下信息

   fenics@7016ac685f58:~$ which python
   /usr/bin/python

但是,当我尝试在 Jupyter Notebook 中使用以下命令时

from fenics import *

我收到以下错误

---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-4-66a9e72f2de9> in <module>()
      2 # Poisson solver in Python using FEniCS
      3 # import FEniCS
----> 4 from fenics import *
      5 #
      6 # create mesh and denfine functional space

ImportError: No module named fenics

我使用的是anaconda提供的Python,下面给出了有关python的详细信息

Python 2.7.12 |Anaconda custom (x86_64)| (default, Jul  2 2016, 17:43:17) 
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
Anaconda is brought to you by Continuum Analytics.
Please check out: http://continuum.io/thanks and https://anaconda.org

which python 给了我以下路径

h147:project0 vikas$ which python
/Users/vikas/anaconda/bin/python

我不知道如何解决这个问题。请帮我。

【问题讨论】:

  • @cel 感谢您的回复,我按照链接给出的指示执行了以下操作但是,当我尝试运行from fenics import * 时,我收到以下错误` ImportError Traceback(最近一次调用最后一次) ImportError: cannot import name cpp `

标签: python path anaconda


【解决方案1】:

我遇到了同样的问题。每当我通过 Anaconda 使用 fenics 时,都会发生一些奇怪的事情。我停用了 Anaconda 并在系统中运行了 fenics。完美运行。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-02-21
    • 1970-01-01
    • 2020-10-06
    • 1970-01-01
    • 2023-01-30
    • 2018-01-11
    • 2021-02-03
    • 2023-03-04
    相关资源
    最近更新 更多