为什么在将Django项目切换到Python 3.6时会出现ModuleNotFoundError?

时间:2017-04-25 07:50:03

标签: python django python-3.x

我用来运行Python 2并拥有一个完全可用的Django应用程序。我现在决定切换到Python 3并使用3.6。当我尝试运行测试时,我现在得到以下堆栈跟踪:

Log

一些谷歌搜索首先引导我http://www.daveoncode.com/2017/03/07/how-to-solve-python-modulenotfound-no-module-named-import-error/,但我认为这些情况都不适用 - 毕竟,它在Python 2中运行良好。接下来我偶然发现了https://github.com/jpadilla/django-rest-framework-xml/issues/17这让我确保Traceback (most recent call last): File "/Users/jonathan/Work/GenettaSoft/modeling-web/modeling/manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/Users/jonathan/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 350, in execute_from_command_line utility.execute() File "/Users/jonathan/anaconda/lib/python3.6/site-packages/django/core/management/__init__.py", line 324, in execute django.setup() File "/Users/jonathan/anaconda/lib/python3.6/site-packages/django/__init__.py", line 18, in setup apps.populate(settings.INSTALLED_APPS) File "/Users/jonathan/anaconda/lib/python3.6/site-packages/django/apps/registry.py", line 115, in populate app_config.ready() File "/Users/jonathan/anaconda/lib/python3.6/site-packages/django/contrib/admin/apps.py", line 22, in ready self.module.autodiscover() File "/Users/jonathan/anaconda/lib/python3.6/site-packages/django/contrib/admin/__init__.py", line 26, in autodiscover autodiscover_modules('admin', register_to=site) File "/Users/jonathan/anaconda/lib/python3.6/site-packages/django/utils/module_loading.py", line 50, in autodiscover_modules import_module('%s.%s' % (app_config.name, module_to_search)) File "/Users/jonathan/anaconda/lib/python3.6/importlib/__init__.py", line 126, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 978, in _gcd_import File "<frozen importlib._bootstrap>", line 961, in _find_and_load File "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 655, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 678, in exec_module File "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removed File "/Users/jonathan/Work/GenettaSoft/modeling-web/modeling/licenses/admin.py", line 2, in <module> from models import LicenseModel ModuleNotFoundError: No module named 'models' 没有真正的帮助。然后我更加拼命地尝试了ModuleNotFound error in django in Django tastypie web application所解释的内容,这对我来说并没有什么意义,但并没有解决问题。所以现在我的想法已经不多了,所以我在这里问你。发生了什么,我该怎么办?

0 个答案:

没有答案