简体   繁体   中英

no module named error python, is it on sys.path?

Okay, I am getting an error that is like no module named credentials

http://i.imgur.com/g3VVhlL.png

I have a credentials.py file in that directory. I am sort of new to python and this is driving me nuts.

How can I debug this, or can anyone tell right off the bat what may be the problem?

When you do python keep_backend/manage.py runserver , then your PYTHONPATH will not include the current directory. Instead, in will include the keep_backend directory.

Since credentials.py is in the current directory, it is not importable.


A workaround is manually adding the right folder to your PYTHONPATH

PYTHONPATH=`pwd`:$PYTHONPATH python keep_backend/manage.py runserver

But you should most likely rethink your directory structure here.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM