我的环境:
操作系统:windows10
pycharm:pycharm-professional-2017.2.3
python:python3.6.2
django:1.11
一个小菜鸟的第一篇技术类博客,先从我今天解决的一个pycharm的报错开始吧~
完整报错展示:
"D:\web\pycharmPro\PyCharm 2017.2.3\bin\runnerw.exe" D:\web\python\python.exe D:/pycharm/myProject/manage.py runserver 127.0.0.1:8000
Performing system checks...Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x044845D0>
Traceback (most recent call last):File "D:\web\python\lib\site-packages\django\utils\autoreload.py", line 227, in wrapperfn(*args, **kwargs)File "D:\web\python\lib\site-packages\django\core\management\commands\runserver.py", line 125, in inner_runself.check(display_num_errors=True)File "D:\web\python\lib\site-packages\django\core\management\base.py", line 359, in checkinclude_deployment_checks=include_deployment_checks,File "D:\web\python\lib\site-packages\django\core\management\base.py", line 346, in _run_checksreturn checks.run_checks(**kwargs)File "D:\web\python\lib\site-packages\django\core\checks\registry.py", line 81, in run_checksnew_errors = check(app_configs=app_configs)File "D:\web\python\lib\site-packages\django\core\checks\urls.py", line 16, in check_url_configreturn check_resolver(resolver)File "D:\web\python\lib\site-packages\django\core\checks\urls.py", line 26, in check_resolverreturn check_method()File "D:\web\python\lib\site-packages\django\urls\resolvers.py", line 254, in checkfor pattern in self.url_patterns:File "D:\web\python\lib\site-packages\django\utils\functional.py", line 35, in __get__res = instance.__dict__[self.name] = self.func(instance)File "D:\web\python\lib\site-packages\django\urls\resolvers.py", line 405, in url_patternspatterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)File "D:\web\python\lib\site-packages\django\utils\functional.py", line 35, in __get__res = instance.__dict__[self.name] = self.func(instance)File "D:\web\python\lib\site-packages\django\urls\resolvers.py", line 398, in urlconf_modulereturn import_module(self.urlconf_name)File "D:\web\python\lib\importlib\__init__.py", line 126, in import_modulereturn _bootstrap._gcd_import(name[level:], package, level)File "<frozen importlib._bootstrap>", line 978, in _gcd_importFile "<frozen importlib._bootstrap>", line 961, in _find_and_loadFile "<frozen importlib._bootstrap>", line 950, in _find_and_load_unlockedFile "<frozen importlib._bootstrap>", line 655, in _load_unlockedFile "<frozen importlib._bootstrap_external>", line 678, in exec_moduleFile "<frozen importlib._bootstrap>", line 205, in _call_with_frames_removedFile "D:\pycharm\myProject\myProject\urls.py", line 17, in <module>from django.urls import path
ImportError: cannot import name 'path'
这个报错我在网上找了半天,都没找到一个满意的解决方法,然后我就在想是不是django的版本不对(我之前下载的django2.0),于是我就重新下载了一个django1.11版本
于是,问题就来了:
怎样卸载以前装的django2.0呢?
我又在网上看了一圈儿,有解决方,那些解决方法里又有写什么要看当时怎么安装,是通过“pip install django == x.xx(版本号)”安装还是用什么egg啥的
反正我也不记得了
按照大神的方法我也没有找到要找的文件夹(site-packages),于是我就用了最简单粗暴的方法:windows文件管理器的搜索功能:
然后删除所有django的文件夹就好了(好像就只有一个),对,文件夹就好
然后就可以用pip命令来安装django1.11啦~
pip install django1.11
安装完成后就可以新建项目啦,反正新我建项目之后就没有出现这个报错了~~~
(要记得新建项目哈,我刚开始没有新建项目,依然出现那个报错,大概是那个原项目里还是用的django2.0吧,不是很懂~)
处女座,虽然做了两年网络工程的学生了,但依然和小白没啥区别·····
所以只能解决这些小白问题了~~
2018年计划每周更新一篇博客
嘿嘿嘿嘿
加油啦~~