Python error “ImportError: No module named”

后端 未结 29 2974
野的像风
野的像风 2020-11-22 07:46

Python is installed in a local directory.

My directory tree looks like this:

(local directory)/site-packages/toolkit/interface.py

29条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-22 07:51

    Based on your comments to orip's post, I guess this is what happened:

    1. You edited __init__.py on windows.
    2. The windows editor added something non-printing, perhaps a carriage-return (end-of-line in Windows is CR/LF; in unix it is LF only), or perhaps a CTRL-Z (windows end-of-file).
    3. You used WinSCP to copy the file to your unix box.
    4. WinSCP thought: "This has something that's not basic text; I'll put a .bin extension to indicate binary data."
    5. The missing __init__.py (now called __init__.py.bin) means python doesn't understand toolkit as a package.
    6. You create __init__.py in the appropriate directory and everything works... ?

提交回复
热议问题