首页 > 其他分享 >ModuleNotFoundError: No module named 'django'

ModuleNotFoundError: No module named 'django'

时间:2023-01-10 09:22:19浏览次数:47  
标签:named lib site django usr 2.2 ModuleNotFoundError local

问题:安装完包无法导入

安装出现:

[root@a928bac91186 project]# pip install django==2.2
Requirement already satisfied: django==2.2 in /usr/local/lib/python3.6/site-packages (2.2)
Requirement already satisfied: sqlparse in /usr/local/lib/python3.6/site-packages (from django==2.2) (0.4.3)
Requirement already satisfied: pytz in /usr/local/lib/python3.6/site-packages (from django==2.2) (2022.7)

查看导入情况

>>> import sys
>>> print(sys.path)
['', '/usr/local/python3/lib/python39.zip', '/usr/local/python3/lib/python3.9', '/usr/local/python3/lib/python3.9/lib-dynload', '/usr/local/python3/lib/python3.9/site-packages']
>>>

发现没有该安装路径

解决:

vi /etc/profile

export PYTHONPATH=/usr/local/lib/python3.6/site-packages/

source /etc/profile

即可!

 

标签:named,lib,site,django,usr,2.2,ModuleNotFoundError,local
From: https://www.cnblogs.com/yu121/p/17039122.html

相关文章

  • cookie与session简介 django操作cookie django操作session
    目录cookie与session简介早期cookies随机字符串解决cookies安全问题禁止浏览器保存cookiesdjango操作cookieset_cookieset_signed_cookierequest.COOKIESdelete_cookie用户......
  • Django模板控制结构(for/forloop/if)
    for语法:{%for%}  {%endfor%} 视图 模板 结果forloopforloop.counter和forloop.revcounter后面带0代表从第0次开始循环,不带代表......
  • Django orm 字段别名
    Djangoorm数据查询结果给字段取别名sql写法类似:selectnameasusername,idasuseridfromusersDjango实现修改列明的方法有两种:方法1:annotatefromdjango.......
  • django_博客练习(文章详情/点赞/评论)
    文章详情页渲染文章内容侧边栏有分类显示通过设置路由的方式传递参数文章id作者用户名文章是通过文章对象渲染到前端的,所以你点击文章时也可以告诉后端你点击的是哪......
  • Django views.py 增,删,改
    fromdjangoimportformsfromdjango.shortcutsimportrender,redirectfromapp01importmodels#Createyourviewshere.defdepart_list(request):  """......
  • python django 云招聘系统(课设、毕设、学习)
    pythondjango云招聘系统(课设、毕设、学习)pythondjango简历系统pythondjango招聘系统pythondjango职位招聘后端:pythondjango数据库:MySQL5.7前端:htmlcssjs等涉及......
  • 解决jupyter-notebook启动缺少模块No module named 'ipyparallel'
    1、启动jupyter-notebook启动缺少模块Nomodulenamed'ipyparallel',具体:Errorloadingserverextensionipyparallel.nbextensionTraceback(mostrecentcalll......
  • django
    django1纯手撸web框架、wsgiref模块下的手撸框架、jinja2模版语法、django框架简介、下载、基本操作等2django静态文件相关配置、请求方法、链接mysql以及django的ORM......
  • Django里ORM常用关键字
    一、ORM常用关键字 #关键概览1.create()2.filter()3.first()last()4.update()5.delete()6.all()7.values()8.values_list()9.distinct()10.order_by()11.g......
  • java: The type of parameter "XXX" has no property named "name".
    java:Thetypeofparameter"XXX"hasnopropertynamed"name".  1、问题现象SpringBoot工程启动的时候,报错如下:java:Thetypeofparameter"DeviceVO"ha......