Python django報錯ImportError: cannot import name find_spec
執行 django-admin startproject mysite報錯如下:
<span style="font-size:14px;">[root@host django]# django-admin startproject mysite
Traceback (most recent call last):
File "/usr/local/bin/django-admin", line 9, in <module>
load_entry_point('Django==1.9.6', 'console_scripts', 'django-admin')()
File "/usr/local/lib/python3.3/site-packages/setuptools-2.0-py3.3.egg/pkg_resources.py", line 348, in load_entry_point
File "/usr/local/lib/python3.3/site-packages/setuptools-2.0-py3.3.egg/pkg_resources.py", line 2311, in load_entry_point
File "/usr/local/lib/python3.3/site-packages/setuptools-2.0-py3.3.egg/pkg_resources.py", line 2025, in load
File "/usr/local/lib/python3.3/site-packages/Django-1.9.6-py3.3.egg/django/core/management/__init__.py", line 10, in <module>
from django.apps import apps
File "/usr/local/lib/python3.3/site-packages/Django-1.9.6-py3.3.egg/django/apps/__init__.py", line 1, in <module>
from .config import AppConfig
File "/usr/local/lib/python3.3/site-packages/Django-1.9.6-py3.3.egg/django/apps/config.py", line 6, in <module>
from django.utils.module_loading import module_has_submodule
File "/usr/local/lib/python3.3/site-packages/Django-1.9.6-py3.3.egg/django/utils/module_loading.py", line 67, in <module>
<span style="color:#ff0000;">from importlib.util import find_spec as importlib_find</span></span>
搜尋以後發現是python版本不正確,我的執行環境是Python3.3.0
find_spec isn't available in Python 3.2.3; it was added in Python 3.4.於是重新安裝Python3.4.0或者升級
wget https://www.python.org/ftp/python/3.4.0/Python-3.4.0.tgz
tar -zxvf Python-3.4.0.tgz
cd Python-3.4.0
./configure
make all
make install
make clean
make distclean
/usr/local/bin/python3 -v
再次執行命令
#django-admin startproject mysite
於是就建立了mysite檔案
相關文章
- ImportError: cannot import name parseImportError
- importError: cannot import name 'izip_longest'ImportError
- ImportError: cannot import name ‘imresize‘解決辦法ImportError
- ImportError: cannot import name ‘BaseQuery‘ from ‘flask_sqlalchemy‘ImportErrorFlaskSQL
- ImportError: cannot import name ‘audio_ops‘ (TensorFlow)ImportError
- 解決 ImportError: cannot import name 'imread' from 'scipy.misc'ImportError
- ImportError: cannot import name 'get_ora_doc' from partially initialized moduleImportErrorZed
- Import Error: cannot import name ‘export_saved_modelImportErrorExport
- cannot import name ‘multiarray‘ from ‘numpy.core‘Import
- cannot import name '_psutil_linux'ImportLinux
- python報錯ImportError: cannot import name ‘Image‘ from ‘PIL‘ 的時候大多數情況下是由於PIL版本和當前python的版本出現了不相容PythonImportError
- pycharm import 報錯PyCharmImport
- import moviepy 報錯Import
- [譯][python]ImportError:attempted relative import with no known parent packagePythonImportErrorPackage
- pyecharts安裝後import錯誤 ImportError: No module named 'pyecharts_snapshot'EchartsImportError
- 使用新版flask-script時報錯No module named flask._compat和cannot import name ‘_request_ctx_stack‘ from ‘flask‘FlaskImport
- inplace-abn 報錯解決: ImportError: libcudart.so.9.0: cannot open shared object file: No such file or dirImportErrorDartObject
- Python報錯:Visual C++ is required和ImportError: DLL load failedPythonC++UIImportErrorAI
- python from import 出錯PythonImport
- 寶塔:續簽SSL證書報錯Verification failed, domain name resolution error or verification URL cannot be accessed!AIError
- name server cannot be used, reason: Temporary failure in name resolutionServerAI
- pip報importError錯誤的一些情況ImportError
- Django 報錯 TemplateDoesNotExistDjango
- Django報錯django.utils.datastructures.MultiValueDictKeyErrorDjangoASTStructError
- 啟動uwsgi報錯ImportError: No module named, unable to load appImportErrorAPP
- Qt 報錯 “類名”does not name a typeQT
- Warning: Cannot redeclare function_name()Function
- 專案問題總結3:MyEclipse匯入專案報錯-"The import javax.servlet cannot be resolved"EclipseImportJavaServlet
- Django 報錯資訊總結Django
- beego報錯 table name: `xxx` not existsGo
- allowedOrigins cannot contain the gateway 報錯AIGateway
- 前端報錯:cannot read property length of undefined前端Undefined
- 關於python安裝dlib報錯“ ImportError: DLL load failed”的解決方法之一PythonImportErrorAI
- AS執行main()方法報錯:SourceSet with name ‘main‘ not foundAI
- gateway 報錯 allowedOrigins cannot contain the specialGatewayAI
- go tool compile 報錯 could not import sync (file not found)GoCompileImport
- python 報錯:raise IllegalCharacterError(f"{value} cannot be used in worksheets.") openpyxl.utils.exceptions.IllegalCharacterErrorPythonAIErrorException
- Django使用終端建立superuser報錯。Django