Import module works in terminal but not in IDLE

前端 未结 6 1679
轮回少年
轮回少年 2020-12-03 21:54

I am trying to import pyodbc module on a windows computer. It works in the terminal, but not the IDLE. The error message in IDLE is:



        
6条回答
  •  天命终不由人
    2020-12-03 22:24

    This typically occurs when multiple versions of python are installed with different paths. You can check to see if you have multiple installations by opening up the IDLE terminal and using

    import sys
    sys.version
    sys.path
    

    These commands will print the system PATH and version of the current instance of python. Use this in both IDLE and the command line terminal to see where each differ. Once you know which version is the one you want then just remove the other. You could also remove all python instances and then reinstall a clean python environment but then you would have to re-install all of your modules using pip or easy_install

提交回复
热议问题