I am a bit new to using the command line, so I apologize if this question is rather basic. I believe a have installed a module called lmfit using
pip3 install lmfit
and it says this was successful. However, I still get a
ModuleNotFoundError: No module named 'lmfit'
when I try to import lmfit in a python script. I've tried to check if it was really installed using
pip3 show lmfit
and this gives the location of the module in a folder called python3.8 on my local computer.
Any advice would be appreciated!
It seems that you have the lmfit
module installed for python 3.8
and you are running python 3.7
on Spyder for which the module is not installed.
Preferrable method for you is option 3 as you said you want to fix it for Spyder. The blockquote explains the detailed procedure to do that.
python 3.8
. You can check how to change the path here (Follow the instructions and replace 3.6 with 3.7 and 3.7 with 3.8 for your case)Open Preferences in Spyder =>
Tools - Preferences
Click on
Python Interpreter
from the options in leftNow the Selected option, right below
Select the Interpreter for all Python Consoles
should beDefault (i.e. use the same as Sypder's)
, Теперь измените его на. Используйте следующий интерпретатор:
, и он попросит путь под ним.Укажите путь к папке установки Python 3.8. Вы можете найти путь, используя:
whereis python3.8
в интерфейсе командной строки ubuntu (Примечание для windows, где python3.8
должен работать нормально).В общем, путь должен быть что-то вроде
\ usr \ bin \ python3.8
, но это зависит от как вы его установили. Возьмите путь кpython3.8
и вставьте его на этом пути. Вы также можете найтиpython3.8
по этому пути и выберите его вручную из интерфейса spyder.Теперь
Примените
it иOk
it. ПерезапуститеSpyder
, и вы должны быть работает python3.8, и теперь вы можете импортироватьlmfit
там.
Визуальное представление этого процесса (кроме как найти путь) можно найти здесь