问题
As the title I'm duelling just with the import of the package lmfit which does not want to load. I just called the interpreter and then typed
import lmfit
but the import does not seem to go in the right direction, and I get this message of error
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/lmfit/__init__.py", line 42, in <module>
from .confidence import conf_interval, conf_interval2d
File "/Library/Python/2.7/site-packages/lmfit/confidence.py", line 12, in <module>
from .minimizer import MinimizerException
File "/Library/Python/2.7/site-packages/lmfit/minimizer.py", line 26, in <module>
from scipy.optimize import differential_evolution, least_squares
ImportError: cannot import name differential_evolution
I took a look here on SO, but all the answers related to ImportError:
did not have satisfying answers, plus I'm quite a newbie in Python, so if there's some mistake I made I'm looking forward for your explanation.
回答1:
It's trying to use scipy
, which it appears you do not have. Try installing scipy. i.e. pip install scipy
or conda install
if using anaconda.
来源:https://stackoverflow.com/questions/49905556/lmfit-package-importerror-cannot-import-name-differential-evolution