Python: importing lmfit.models fails

十年热恋 提交于 2019-12-13 04:44:41

问题


This post is related to my other one where I was told to use lmfit to fix my problem.

I installed lmfit in anaconda Prompt with conda install --channel "conda-forge" lmfit which worked. But now when I try to use it in my Programm I get the following error:

ModuleNotFoundError: No module named 'lmfit.model'; 'lmfit' is not a package

Thats how the beginning of my Program looks like:

import numpy as np
import math
import scipy    #I dont need scipy, but I read, that lmfit needs scipy. It doesn't change anything when its there or not.
import matplotlib.pyplot as plt
from lmfit.model import GaussianModel

I also tried to import lmfit seperatly like:

import lmfit
from lmfit.model import GaussianModel

But it doesn't work either...

I tried everything from the lmfit website, but using the "git"-thing in Anaconda Prompt gives me an error (something like command doesn't exist)

I also found this post, and importing from lmfit import * works. Now I have the problem that I somehow need to import the GaussianModel, which I don't know how to do. If I just add from lmfit import GaussianModel I get the Error

ImportError: cannot import name 'GaussianModel'

I also read something about the order of importing packages and modules is important - is this what the problem is about? How can I fix this?

I work on windows with anaconda/spider.

来源:https://stackoverflow.com/questions/48894235/python-importing-lmfit-models-fails

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!