import sys
print sys.path
['D:\\zjm_code\\register2', 'C:\\WINDOWS\\system32\\python25.zip', 'D:\\Python25\\DLLs', 'D:\\Python25\\lib', 'D:\\Python25\\lib\\plat-win', 'D:\\Python25\\lib\\lib-tk', 'D:\\Python25', 'D:\\Python25\\lib\\site-packages']
and
#from django.core.management import setup_environ
from register2 import settings
#setup_environ(settings)
Traceback (most recent call last):
File "D:\zjm_code\register2\b.py", line 4, in <module>
from register2 import settings
ImportError: No module named register2
why ,
thanks
When directory 'D:\\\\zjm_code\\\\register2'
is on sys.path
, this means you can import modules and packages that are INSIDE that directory.
To import the directory register2
itself, two conditions:
'D:\\\\zjm_code'
, must be on sys.path
; and 'D:\\\\zjm_code\\\\register2\\\\__init__.py'
must exist __init__.py
is the code that actually executes when you "import the directory".
大声笑,因为它尝试从register2导入某些内容,但由于路径上没有D:\\ zjm_code而无法这样做。
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.