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 ‘audio_ops‘ (TensorFlow)ImportError
- ImportError: cannot import name ‘BaseQuery‘ from ‘flask_sqlalchemy‘ImportErrorFlaskSQL
- ImportError: cannot import name ‘imresize‘解決辦法ImportError
- 解決 ImportError: cannot import name 'imread' from 'scipy.misc'ImportError
- ImportError: cannot import name 'get_ora_doc' from partially initialized moduleImportErrorZed
- cannot import name '_psutil_linux'ImportLinux
- Import Error: cannot import name ‘export_saved_modelImportErrorExport
- python報錯ImportError: cannot import name ‘Image‘ from ‘PIL‘ 的時候大多數情況下是由於PIL版本和當前python的版本出現了不相容PythonImportError
- cannot import name ‘multiarray‘ from ‘numpy.core‘Import
- 使用新版flask-script時報錯No module named flask._compat和cannot import name ‘_request_ctx_stack‘ from ‘flask‘FlaskImport
- pyecharts安裝後import錯誤 ImportError: No module named 'pyecharts_snapshot'EchartsImportError
- pycharm import 報錯PyCharmImport
- inplace-abn 報錯解決: ImportError: libcudart.so.9.0: cannot open shared object file: No such file or dirImportErrorDartObject
- python from import 出錯PythonImport
- Warning: Cannot redeclare function_name()Function
- 寶塔:續簽SSL證書報錯Verification failed, domain name resolution error or verification URL cannot be accessed!AIError
- allowedOrigins cannot contain the gateway 報錯AIGateway
- Django 報錯 TemplateDoesNotExistDjango
- beego報錯 table name: `xxx` not existsGo
- gateway 報錯 allowedOrigins cannot contain the specialGatewayAI
- 啟動uwsgi報錯ImportError: No module named, unable to load appImportErrorAPP
- pip報importError錯誤的一些情況ImportError
- Django報錯django.utils.datastructures.MultiValueDictKeyErrorDjangoASTStructError
- Qt 報錯 “類名”does not name a typeQT
- 關於python安裝dlib報錯“ ImportError: DLL load failed”的解決方法之一PythonImportErrorAI
- 關閉tomcat報錯Cannot allocate memoryTomcat
- 前端報錯:cannot read property length of undefined前端Undefined
- ImportError: libffi.so.7: cannot open shared object file: No such file or directoryImportErrorObject
- Python3.7上安裝Django1.11啟動報錯PythonDjango
- 【解決方法】vscode import cv2報錯Import "cv2" could not be resolvedPylancereportMissingImportsVSCodeImport
- go tool compile 報錯 could not import sync (file not found)GoCompileImport
- import提升導致Fundebug報錯:“請配置apikey”ImportAPI
- python 報錯:raise IllegalCharacterError(f"{value} cannot be used in worksheets.") openpyxl.utils.exceptions.IllegalCharacterErrorPythonAIErrorException
- 解決tensorboard報錯ValueError: Duplicate plugins for name projectorORBErrorPluginProject
- AS執行main()方法報錯:SourceSet with name ‘main‘ not foundAI
- Django 報錯資訊總結Django
- Yii2.012 版本與 PHP7.2 不相容 (報錯 Cannot use 'Object' as class name as...) 問題的處理方法PHPObject