问题分析:

在pyharm中项目可以正常运行但是在终端 终端输入python manage.py runserver首次测试项目时,出现了无法引用Django的错误。

Traceback (most recent call last):
File "manage.py", line 8, in <module>
from django.core.management import execute_from_command_line
ImportError: No module named 'django' During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "manage.py", line 14, in <module>
import django
ImportError: No module named 'django' During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "manage.py", line 17, in <module>
"Couldn't import Django. Are you sure it's installed and "
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?

可能出现的问题:

  • 有不同版本的Python,当前项目使用了没有安装Django的Python。
  • 创建的虚拟环境时,没有导入之前下载的包,导致在环境下搜索不到Django。
  • Django版本过低。

解决方案:

将pyharm文件夹下site-packages中所有的文件复制一份到python的Lib文件夹 虚拟环境中。

然后就可以在终端跑起你的项目咯

manage.py“Couldn't import Django”报错的问题解决的更多相关文章

  1. Django学习(1)——python manage.py startapp app-name新建app报错问题

    作为一个刚接触python的小白,开始学习Django注定前路漫漫,记录一下学习过程中的问题和解决方案. 感谢“自强学堂”的无私奉献,根据教程安装了Django 1.9.12后,尝试新建项目,此时使用 ...

  2. eclipse+PyDev里面import win32api报错的问题解决

    windows下面eclipse+PyDev的开发环境,安装了pywin32,写import win32api时老提示错误,在idle里正常执行. 原来是安装python库时,python安装路径下面 ...

  3. Django报错:OSError: raw write() returned invalid length 4 (should have been between 0 and 2)

    在使用Django时Django报错:Django报错:OSError: raw write() returned invalid length 4 (should have been between ...

  4. 在cmd下import cv2报错——OpenCV实现BRISK

    平台:win10 x64 +JetBrains PyCharm 2018.2.4 x64 +Anaconda3(python3.7.0+opencv3.4.5) Issue说明:同学发了个python ...

  5. Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name.

    Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name. 我 ...

  6. appium---【已解决】【Mac】from appium import webdriver报错提示“Unresolved import webdriver”

    报错提示: from appium import webdriver提示Unresolved import webdriver 报错原因:没有安装Appium_Python_Client 解决办法: ...

  7. pycharm 中 import requests 报错

    一 , 使用Pycharm来抓取网页的时候,要导入requests模块,但是在pycharm中 import requests 报错. 原因: python中还没有安装requests库 解决办法: ...

  8. Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.

    Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and ...

  9. import tensorflow 报错: tf.estimator package not installed.

    import tensorflow 报错: tf.estimator package not installed. 解决方案1: 安装 pip install tensorflow-estimator ...

  10. pycharm import scrapy 报错,No module named 'scrapy'

    本地通过下载 pip install scrapy安装成功后,在pychram里面 import scrapy报错 后来在找了各种解决方法,重装wheel,twisted,都不行,最后发现是需要改Pr ...

随机推荐

  1. LVS负载均衡(1)-- LVS概述及LVS网络模型

    目录 1. 负载均衡集群概述 2. LVS理论基础 2.1 LVS常用术语 2.2 LVS数据调度原理 2.3 LVS工作模型 2.3.1 NAT模型 2.3.2 DR模型 2.3.3 TUNNEL模 ...

  2. selenium Webdriver版本和浏览器版本不匹配问题:ChromeDriver only supports Chrome version 119 Current browser version is 124.0.6367.202

    问题描述 代码如下: from selenium import webdriver from selenium.webdriver.common.by import By def test01(): ...

  3. iframe 高度设置为0时还有占位_iframe占位

    iframe是一个内联元素,默认是跟baseline对齐的,iframe后边有个看不见.摸不着的行内空白节点,空白节点占据着高度,iframe与空白节点的基线对齐,导致了div被撑开,从而出现滚动条, ...

  4. 全球厂商之最,华为17篇论文入选国际数据库顶会ICDE

    本文分享自华为云社区<全球厂商之最,华为GaussDB&GeminiDB,17篇论文入选国际数据库顶会ICDE> ,作者:GaussDB 数据库. 5月13-17日,国际数据库顶级 ...

  5. 轻松下载k8s.gcr.io,gcr.io,quay.io镜像

    目录 一.系统环境 二.前言 三.使用现成的镜像代理仓库下载镜像 3.1 使用阿里云镜像仓库 3.2 使用lank8s.cn镜像仓库 3.3 使用中科大镜像 一.系统环境 服务器版本 docker软件 ...

  6. GROUP BY clause and contains nonaggregated 报错处理

    1055 - Expression #16 of SELECT list is not in GROUP BY clause and contains nonaggregated column 报错处 ...

  7. 使用爬虫利器 Playwright,轻松爬取抖查查数据

    使用爬虫利器 Playwright,轻松爬取抖查查数据 我们先分析登录的接口,其中 url 有一些非业务参数:ts.he.sign.secret. 然后根据这些参数作为关键词,定位到相关的 js 代码 ...

  8. 【论文笔记】R-CNN系列之代码实现

    代码源码 前情回顾:[论文笔记]R-CNN系列之论文理解 整体架构 由三部分组成 (1)提取特征的卷积网络extractor (2)输入特征获得建议框rois的rpn网络 (3)传入rois和特征图, ...

  9. 异步长传文件插件 jquery validate 前端验证

    异步文件上传插件:http://fex.baidu.com/webuploader/getting-started.html html5 FormData 可以实现无刷新上传  有空了解 FileRe ...

  10. ABC330

    D 记录每一行,每一列有多少个 o,然后统计答案即可. code E 想到 \(mex^{i \le n}_{i = 1} a_i \le n\) 这整个题就可做了(赛时因为没想到这个,痛失 \(47 ...