CodeAnalysis icon indicating copy to clipboard operation
CodeAnalysis copied to clipboard

怎么解决 Couldn't import Django.报错,详情如下:

Open Hedyt opened this issue 3 years ago • 3 comments

[root@BYVL-OPS-49-7 server]# bash ./scripts/deploy.sh init Start to init server data... Start to init server config... Init directory config ln: failed to create symbolic link ‘/CodeAnalysis/server/logs/main_log/log’: File exists ln: failed to create symbolic link ‘/CodeAnalysis/server/logs/analysis_log/log’: File exists ln: failed to create symbolic link ‘/CodeAnalysis/server/logs/login_log/log’: File exists ln: failed to create symbolic link ‘/CodeAnalysis/server/logs/file_log/log’: File exists Init server config Start to init db, create database... mysql: [Warning] Using a password on the command line interface can be insecure. Finish to init db Start to install requirement... -------注意-------- 如果访问官方pypi源(files.pythonhosted.org)超时或访问失败,可以配置为腾讯云pypi源进行下载,配置方式可以执行以下命令: mkdir ~/.pip/ && echo [global]nindex-url = https://mirrors.cloud.tencent.com/pypi/simple >> ~/.pip/pip.conf -------注意-------- Configuration file could not be loaded. File contains no section headers. file: '/root/.pip/pip.conf', line: 1 'extra-index-url = https://mirrors.cloud.tencent.com/pypi/simple\n' Init main db Traceback (most recent call last): File "manage.py", line 23, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Traceback (most recent call last): File "manage.py", line 23, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Init analysis db Traceback (most recent call last): File "manage.py", line 18, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Traceback (most recent call last): File "manage.py", line 18, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Init login db Traceback (most recent call last): File "manage.py", line 17, in main from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 28, in main() File "manage.py", line 23, in main ) from exc ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? Traceback (most recent call last): File "manage.py", line 17, in main from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 28, in main() File "manage.py", line 23, in main ) from exc ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? Init file db Traceback (most recent call last): File "manage.py", line 18, in main from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 29, in main() File "manage.py", line 24, in main ) from exc ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? Init main db Init checkertool and checkerpackage Traceback (most recent call last): File "manage.py", line 23, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Traceback (most recent call last): File "manage.py", line 23, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Traceback (most recent call last): File "manage.py", line 23, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Traceback (most recent call last): File "manage.py", line 23, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Init analysis db Traceback (most recent call last): File "manage.py", line 18, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Traceback (most recent call last): File "manage.py", line 18, in from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django' Init file db Traceback (most recent call last): File "manage.py", line 18, in main from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 29, in main() File "manage.py", line 24, in main ) from exc ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? Init login db Traceback (most recent call last): File "manage.py", line 17, in main from django.core.management import execute_from_command_line ModuleNotFoundError: No module named 'django'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "manage.py", line 28, in main() File "manage.py", line 23, in main ) from exc ImportError: Couldn't import Django. Are you sure it's installed and available on your PYTHONPATH environment variable? Did you forget to activate a virtual environment? ################################ Current dafault admin/password: CodeDog/admin ################################

Hedyt avatar Jun 14 '22 10:06 Hedyt

已安装,还是会出现上面的报错。 [root@BYVL-OPS-49-7 server]# django-admin --version 1.11.27

Hedyt avatar Jun 14 '22 10:06 Hedyt

本地是否没有安装Python3.7环境呢?

Lingghh avatar Jun 15 '22 04:06 Lingghh

谢谢反馈,上面提的问题已解决 重新核对了python 环境 以及安装了uwsgi

Hedyt avatar Jun 16 '22 08:06 Hedyt