我一直收到这些错误
^C(trydjango)apples-MacBook-Pro:src ray$ ./manage.py runserver
Performing system checks...
Unhandled exception in thread started by <function wrapper at 0x108f612a8>
Traceback (most recent call last):
File "/Library/Python/2.7/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/Library/Python/2.7/site-packages/django/core/management/commands/runserver.py", line 116, in inner_run
self.check(display_num_errors=True)
File "/Library/Python/2.7/site-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/Library/Python/2.7/site-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/Library/Python/2.7/site-packages/django/core/checks/urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "/Library/Python/2.7/site-packages/django/core/checks/urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "/Library/Python/2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/Library/Python/2.7/site-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "/Library/Python/2.7/site-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/Users/ray/Desktop/mypy/2 trydjango jan 30 ajax search/src/try/urls.py", line 21, in <module>
from posts import views
File "/Users/ray/Desktop/mypy/2 trydjango jan 30 ajax search/src/posts/views.py", line 1, in <module>
from urllib.parse import quote_plus
ImportError: No module named parse
如何将其切换回使用正确的解释器。当我尝试切换它并选择3.5没有任何改变
欢迎所有帮助。这个项目花了很多时间差不多完成了。
它使用我的macs python而不是3.5
答案 0 :(得分:0)
在Python 3中添加了urllib.parse。您需要将Mac从Python 2.7升级到Python 3。
打开终端。
xcode-select --install
ruby -e&#34; $(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)&#34;
将此添加到$ HOME / .bash_profile
export PATH = / usr / local / bin:$ PATH
然后, 来源$ HOME / .bash_profile
然后, brew install python3
检查安装方式, python3 --version