How to solve ModuleNotFound Error in IDLE?

笑着哭i 提交于 2019-12-14 02:07:27

问题


I am using ubuntu 18.04. I first installed Python along with anacondafrom terminal whose version is 3.7.0 and I have launched Jupyter notebook and Spyder as well. Then I installed IDLE whose version is 3.6.6+ and I am currently working in IDLE but then when I tried to import module,it shows the error: No module found. I checked for the path as well for both in IDLE and Terminal which are different.How do I solve this problem?

when I checked the python path,

In terminal,

/home/reema/anaconda3/lib/python37.zip:/home/reema/anaconda3/lib/python3.7:/home/reema/anaconda3/lib/python3.7/lib-dynload:/home/reema/anaconda3/lib/python3.7/site-packages

In IDLE,

['', '/home/reema', '/usr/bin', '/usr/lib/python36.zip', '/usr/lib/python3.6', '/usr/lib/python3.6/lib-dynload', '/usr/local/lib/python3.6/dist-packages', '/usr/lib/python3/dist-packages']

I tried appending in IDLE but it doesn't work.


回答1:


Your problem is due to the different interpreters installing modules in different paths, and because the default interpreter at the command prompt is likely 3.7, while the installed Idle uses 3.6

The answer to your problem is to use pip to install new modules and invoke pip as follows

$ python3.x -m pip install ...

This way you know which interpreter is called, and each times the correct version of pip is invoked and, each time, the module is installed in the correct path for a given interpreter.

I have to add that, as far as I can tell, the Anaconda distribution does not support Idle.



来源:https://stackoverflow.com/questions/53258737/how-to-solve-modulenotfound-error-in-idle

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