django创建项目时,urls.py报错:No module named 'index.urls'

django创建音乐网站项目时,urls.py写入代码后,pycharm一直报错: No module named 'index.urls'

用idle运行时候就报错:
Requested setting INSTALLED_APPS, but settings are not configured. You must either define the environment variable DJANGO_SETTINGS_MODULE or call settings.configure() before accessing settings.

创建过程中只修改了urls.py 和setting.py 文件
代码如下:
[b]urls.py[/b]

from django.contrib import admin

from django.urls import path, include

from django.conf.urls import url

from django.views import static

from django.conf import settings

urlpatterns = [

path('admin/', admin.site.urls),
path('', include('index.urls')),
path('ranking.html', include('ranking.urls')),
path('play/', include('play.urls')),
path('comment/', include('comment.urls')),
path('search/', include('search.urls')),
path('user/', include('user.urls')),

]

[b]settings.py[/b]
(部分代码)
INSTALLED_APPS = [

'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'index',
'ranking',
'user',
'play',
'search',
'comment',

]

MIDDLEWARE = [

'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
# 使用中文
'django.middleware.locale.LocaleMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',

]

ROOT_URLCONF = 'music.urls'

TEMPLATES = [

{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [
        os.path.join(BASE_DIR, 'templates'),
        os.path.join(BASE_DIR, 'index/templates'),
        os.path.join(BASE_DIR, 'ranking/templates'),
        os.path.join(BASE_DIR, 'user/templates'),
        os.path.join(BASE_DIR, 'play/templates'),
        os.path.join(BASE_DIR, 'comment/templates'),
    ],
    'APP_DIRS': True,
    'OPTIONS': {
        'context_processors': [
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
        ],
    },
},

]

WSGI_APPLICATION = 'music.wsgi.application'

DATABASES = {

'default': {
    'ENGINE': 'django.db.backends.mysql',
    'NAME': 'music_db',
    'USER': 'root',
    'PASSWORD': '1234',
    'HOST': '127.0.0.1',
    'POST': '3306',
}

}

请问这种情况该如何处理呢?求指点

1个回答

已解决:在app下添加urls.py就可以了

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
创建Django, ModuleNotFoundError: No module named 'django'报错
在Pycharm上创建Django项目之后,在Terminal命令行运行命令:python manage.py startapp login,然后报错,报错内容如下:rnrnTraceback (most recent call last):rn File "manage.py", line 10, in rn raise excrn File "manage.py", line 8, in rn from django.core.management import execute_from_command_linernModuleNotFoundError: No module named 'django'rnrn我将django安装在anaconda中,python的版本是3.7,django的版本是2.1.5rnrn卸载之后重新装还是会报错,什么原因?rn
Django的urls.py加一个url就报错
[img=https://img-bbs.csdn.net/upload/201605/29/1464504991_679379.png][/img]rnrn上面是文件结构rnrn下面是添加的内容rn[img=https://img-bbs.csdn.net/upload/201605/29/1464505024_612375.png][/img]rnrn最后报错的内容:rn[img=https://img-bbs.csdn.net/upload/201605/29/1464505131_63858.png][/img]rnrn附加我的django版本如下:rn[img=https://img-bbs.csdn.net/upload/201605/29/1464505287_181565.png][/img]
No module named ***
初学。rn Eclipse + PyDev 环境下,对一个项目debug、运行时,rn报了N多个 “No module named ***”。。。rnrn我自己创建一个hello world 的程序是可以调试、运行的,但多个*.py 在一起时,就出错。rnrn这些 modules 如何加载进来? 不能一个一个加载吧,我这有几十个 modules 缺失。。。rnrn请指点一下,谢谢。 分数不多,意思一下
No module named 'MySQLdb'(第一次django下创建数据库迁移,报错)
运行环境:ubuntu14.04 python3.5.2 django1.8.17第一次django下创建数据库迁移 运行命令为:python manage.py makemigrations blog报错信息: django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named
启动Django报No module named ‘MySQLdb’的解决方法
错误信息: django.core.exceptions.ImproperlyConfigured:Error loading MySQLdb module: No module named 'MySQLdb". 之前网上搜过,好多帖子都是说python3 不再支持MySQLdb,其实是需要安装mysqlclient 安装的方法: 方法一: pip install mysqlclient 方法二:...
django创建model出错: ImportError: No module named
环境:Django-1.9.1-py2.7 + centos 3.10.0 + mysql5.0rn教程:http://www.runoob.com/django/django-model.htmlrnrn我按着教程走,创建了HelloWorld的proj,之后创建TestModel的app,这时候我的目录是这样的:rn[root@VM_9_170_centos HelloWorld]# treern.rn|-- HelloWorldrn| |-- __init__.pyrn| |-- __init__.pycrn| |-- db.sqlite3rn| |-- settings.pyrn| |-- settings.pycrn| |-- templatesrn| | |-- base.htmlrn| | `-- hello.htmlrn| |-- urls.pyrn| |-- urls.pycrn| |-- view.pyrn| |-- view.pycrn| |-- wsgi.pyrn| `-- wsgi.pycrn|-- TestModelrn| |-- __init__.pyrn| |-- __init__.pycrn| |-- admin.pyrn| |-- admin.pycrn| |-- apps.pyrn| |-- migrationsrn| | `-- __init__.pyrn| |-- models.pyrn| |-- models.pycrn| |-- tests.pyrn| `-- views.pyrn|-- db.sqlite3rn`-- manage.pyrnrnHelloWorld/settings.py:rnINSTALLED_APPS = [rn 'django.contrib.admin',rn 'django.contrib.auth',rn 'django.contrib.contenttypes',rn 'django.contrib.sessions',rn 'django.contrib.messages',rn 'django.contrib.staticfiles',rn 'TestModel',rn]rnrnTestModel/models.pyrnclass Test(models.Model):rn name = models.CharField(max_length=20)rnrn我执行命令: python manage.py syncdbrn报错:rnUnknown command: 'syncdb'rnType 'manage.py help' for usage.rnrn我怀疑跟教程目录不一样,把TestModel mv 到HelloWorld里:rnmv TestModel/ HelloWorld/rnrn重新执行: python manage.py syncdbrn报错:rn[root@VM_9_170_centos HelloWorld]# python manage.py syncdbrnTraceback (most recent call last):rn File "manage.py", line 9, in rn execute_from_command_line(sys.argv)rn File "/usr/lib/python2.7/site-packages/Django-1.9.1-py2.7.egg/django/core/management/__init__.py", line 353, in execute_from_command_linern utility.execute()rn File "/usr/lib/python2.7/site-packages/Django-1.9.1-py2.7.egg/django/core/management/__init__.py", line 327, in executern django.setup()rn File "/usr/lib/python2.7/site-packages/Django-1.9.1-py2.7.egg/django/__init__.py", line 18, in setuprn apps.populate(settings.INSTALLED_APPS)rn File "/usr/lib/python2.7/site-packages/Django-1.9.1-py2.7.egg/django/apps/registry.py", line 85, in populatern app_config = AppConfig.create(entry)rn File "/usr/lib/python2.7/site-packages/Django-1.9.1-py2.7.egg/django/apps/config.py", line 90, in creatern module = import_module(entry)rn File "/usr/lib64/python2.7/importlib/__init__.py", line 37, in import_modulern __import__(name)rnImportError: No module named TestModelrnrn网上看了很多,基本都是版本问题,但是我这里INSTALLED_APPS应该没错。求助高手解答。rn
Python用django提示 no module named。。。
已经安装好python2 和django,pip,virtuel environment,rnpath设置如下:C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Python27;C:\Python27\python.exe;C:\Python27\Scripts\;C:\Python27\Lib\site-packages\django\bin;rnrn新建了一个PYTHONPATH,设置如下:C:\Python27\;C:\Python27\DLLs;C:\Python27\Lib;C:\Python27\Lib\lib-tk;C:\other-foolder-on-the-path;rn在桌面新建了一个项目:Django-admin.py startproject SCOR,桌面已建好rn,可是当我输入:Python manage.py runserver时就显示截图最后几行的提示:rn[img=https://img-bbs.csdn.net/upload/201508/25/1440516319_378280.jpg][/img]rnrnimport error: no module named 。。。。网上找了几个帖子,无图看不懂在说什么,谢谢指教了
Django urls.py 的相关问题
Specifying a namespace in include() without providing an app_name is not supported.     自学<<Python编程从入门到实践>>  袁国忠 译 这书已有3个月了,发现刚开始还不错的,但自学到Django  这部分,开始代码有些敲不到了,估计是2016年出版的原因,很多东西都没更新上。  ...
django里urls.py的问题
urls.py里面的urlpatterns能不能实现直接映射到静态页面,而不是映射到一个函数再通过函数条用模板生成页面。如果能怎样实现呢?
ubuntu下调用keras报错:No module named 'error'
cuda9.0和TensorFlow1.8.0已安装rnimport tensorflow也没有问题,就是再import keras出错,求大神解答!rn报错如下:rnUsing TensorFlow backend.rnTraceback (most recent call last):rn File "/home/zhangzhiyang/PycharmProjects/tensorflow1/test_keras.py", line 2, in rn import kerasrn File "/home/zhangzhiyang/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/__init__.py", line 3, in rn from . import utilsrn File "/home/zhangzhiyang/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/utils/__init__.py", line 26, in rn from .multi_gpu_utils import multi_gpu_modelrn File "/home/zhangzhiyang/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/utils/multi_gpu_utils.py", line 7, in rn from ..layers.merge import concatenatern File "/home/zhangzhiyang/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/layers/__init__.py", line 4, in rn from ..engine.base_layer import Layerrn File "/home/zhangzhiyang/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/engine/__init__.py", line 7, in rn from .network import get_source_inputsrn File "/home/zhangzhiyang/anaconda3/envs/tensorflow/lib/python3.6/site-packages/keras/engine/network.py", line 9, in rn import yamlrn File "/home/zhangzhiyang/anaconda3/envs/tensorflow/lib/python3.6/site-packages/yaml/__init__.py", line 2, in rn from error import *rnModuleNotFoundError: No module named 'error'rnrnrnrnrn我的版本:tensorflow1.8.0,cuda9.0,cuDNN7,anaconda3,python3.6.5rn我的tensorflow和keras安装路径均为anaconda3/envs/tensorflow/lib/python3.6/site-packagesrnrn我的.bashrc文件如下:rnrnexport PATH="/home/zhangzhiyang/anaconda3/bin:$PATH"rnexport LD_LIBRARY_PATH="/home/zhangzhiyang/newdisk/cuda-9.0/lib64:$LD_LIBRARY_PATH"rnexport PATH="/home/zhangzhiyang/newdisk/cuda-9.0/bin:$PATH"rnexport CUDA_HOME=$CUDA_HOME:"/home/zhangzhiyang/newdisk/cuda-9.0"rnrnrnrn个人推测可能是python版本的问题,但不知如何解决,我第一次pip Keras未指定安装路径,结果keras安装在了python2.7下,这次我指定了路径为python3.6/site_packages,但是报了如上错误,是否keras不支持python3?rnrn求大神解答!
python 报错:No module named 'requests 解决办法
解决python 报错:No module named 'requests 解决办法
tensorflow报错:ImportError:No module named 'tensorflow.python.platform'?
今天要打开tensorboard的时候出现报错:rn![图片说明](https://img-ask.csdn.net/upload/201906/02/1559476838_499887.png)rnrn然后试着用pythonrnimport tensorflow as tfrn检查了一下,还是同样的报错。rn所有用到import TensorFlow的程序都无法运行了。rnrn用网上的方法,添加PATH或者给tensorflow升级、重新安装后都是这样,不知道是为啥。
python 报错 ,显示ModuleNotFoundError: No module named 'exception'
显示错误,使用的是python3.6rn如果不能够使用这个模块,可以换成什么呢? 还是python3没有整个模块呢rnrn[code=python]Traceback (most recent call last):rn File "C:\Users\IBM\Desktop\商品信息.py", line 4, in rn from exception import ValueErrorrnModuleNotFoundError: No module named 'exception'[/code]rnrn[code=python]from lxml import html rnimport csv,os,jsonrnimport requestsrnfrom exception import ValueErrorrnfrom time import sleeprnrndef AmzonParser(url):rn headers = 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.90 Safari/537.36'rn page = requests.get(url,headers=headers)rn while True:rn sleep(3)rn try:rn doc = html.fromstring(page.content)rn XPATH_NAME = '//h1[@id="title"]//text()'rn XPATH_SALE_PRICE = '//span[contains(@id,"ourprice") or contains(@id,"saleprice")]/text()'rn XPATH_ORIGINAL_PRICE = '//td[contains(text(),"List Price") or contains(text(),"M.R.P") or contains(text(),"Price")]/following-sibling::td/text()'rn XPATH_CATEGORY = '//a[@class="a-link-normal a-color-tertiary"]//text()'rn XPATH_AVAILABILITY = '//div[@id="availability"]//text()'rnrn RAW_NAME = doc.xpath(XPATH_NAME)rn RAW_SALE_PRICE = doc.xpath(XPATH_SALE_PRICE)rn RAW_CATEGORY = doc.xpath(XPATH_CATEGORY)rn RAW_ORIGINAL_PRICE = doc.xpath(XPATH_ORIGINAL_PRICE)rn RAw_AVAILABILITY = doc.xpath(XPATH_AVAILABILITY)rnrn NAME = ' '.join(''.join(RAW_NAME).split()) if RAW_NAME else Nonern SALE_PRICE = ' '.join(''.join(RAW_SALE_PRICE).split()).strip() if RAW_SALE_PRICE else Nonern CATEGORY = ' > '.join([i.strip() for i in RAW_CATEGORY]) if RAW_CATEGORY else Nonern ORIGINAL_PRICE = ''.join(RAW_ORIGINAL_PRICE).strip() if RAW_ORIGINAL_PRICE else Nonern AVAILABILITY = ''.join(RAw_AVAILABILITY).strip() if RAw_AVAILABILITY else Nonernrn if not ORIGINAL_PRICE:rn ORIGINAL_PRICE = SALE_PRICErnrn if page.status_code!=200:rn raise ValueError('captha')rn data = rn 'NAME':NAME,rn 'SALE_PRICE':SALE_PRICE,rn 'CATEGORY':CATEGORY,rn 'ORIGINAL_PRICE':ORIGINAL_PRICE,rn 'AVAILABILITY':AVAILABILITY,rn 'URL':url,rn rnrn return datarn except Exception as e:rn print (e) rndef ReadAsin():rn # AsinList = csv.DictReader(open(os.path.join(os.path.dirname(__file__),"Asinfeed.csv")))rn AsinList = ['B0046UR4F4',rn 'B00JGTVU5A',rn 'B00GJYCIVK',rn 'B00EPGK7CQ',rn 'B00EPGKA4G',rn 'B00YW5DLB4',rn 'B00KGD0628',rn 'B00O9A48N2',rn 'B00O9A4MEW',rn 'B00UZKG8QU',]rn extracted_data = []rn for i in AsinList:rn url = "http://www.amazon.com/dp/"+irn print ("Processing: "+url)rn extracted_data.append(AmzonParser(url))rn sleep(5)rn f=open('data.json','w')rn json.dump(extracted_data,f,indent=4)rnrnrnif __name__ == "__main__":rn ReadAsin()rn[/code]
执行python脚本报错No module named requests解决方法
首先需要先安装下pip       根目录执行命令  yum install python-pip 然后安装requests,                                      pip install requests python2.6下这样是可以成功安装的,但其它版本根据网上的资料看可能有问题,需要编译源码安装
python 2.7报错 No module named http.cookiejar
python 2.7中rnimport http.cookiejarrnrn报错:ImportError: No module named http.cookiejarrnrn网上搜不到,是为何?
Python查询MySQL数据库时报错No module named MYSQLdb 问题解决
No module named MYSQLdb 问题解决 问题描述: 在Linux中写Python查询MySQL数据库时报错:ImportError: No module named MySQLdb 对于不同的系统和程序有如下的解决方法: easy_install mysql-python (mix os) pip install mysql-python (mix os/ pytho...
使用yum安装软件时报错:No module named yum
使用yum安装软件时报错:No module named yum
IDEA2018.5创建项目时报错
今天小编像往常一样,点击打开Intellij IDEA时报错了,昨天还好好的今天怎么突然罢工了。贴照看看: 1.打开Intellij IDEA就报这种错。小编也是一脸的无奈。 2.创建项目时报错,看了错误原因,原来是找不到:https://start.spring.io。 3.找到问题的原因,接下来就是配置了。进入Configure-->settings中 4.搜索 HT...
centos7执行yum命令时报错: No module named yum
我把之前的yum命令卸载了,然后重新安装,安装后一直出现 No module named yum这个错误,然后在网上查找资料说是python版本不匹配,然后又安装了几个python版本,有2.4、2.6、2.7,一个个试过都不行,请问各位大神有什么解决办法,非常感谢!!!​
调试时报错:No module named pysqlite2怎么解决?急!!!
刚学Python,引用了一句 from pysqlite2 import dbapi2 as sqlite ,在调试时报错:No module named pysqlite2,各位高手给俺说说是怎么回事啊,怎么解决啊。急!!!
安装tushare时报错:No module named 'lxml'的解决方法
在尝试使用 pip3 install tushare安装 tushare这个包的时候一直报错:ModuleNotFoundError: No module named 'lxml'    ----------------------------------------Command "python setup.py egg_info" failed with error code 1 in C:\...
Scrapy爬虫时报错“No module named 'win32api'”,解决方法(亲测有效)
 1、写了一个scrapy的demo爬虫,但是运行爬虫时遇到以下错误,提示缺少win32api模块 百度后发现,windows下需要安装一个名为pywin32的模块,通过命令pip install pywin32安装既可以。 安装完成后,再次执行scrapy爬虫程序即可正常运行。...
Django创建项目时失败的问题
第一次使用django创建项目,根据教程使用了如下命令django-admin.py startproject HelloWorld 发现文件夹下居然还是空的,相关环境变量已经设置好,命令的确已经运行,但是项目却没有生成,后来检查原因如下: 我把.py的默认打开方式设为了PyCharm,所以执行命令只是打开了该文件,把其的默认打开方式设为Python.exe即可
linux下No module named virtkey
linux下最近要用到模拟键盘操作,网上找了很多方法找到了virtkey,但是在运行的时候提示No module named virtkey,众神给点帮助吧,谢谢,困扰我好久了rnrn命令执行情况如下:rn[root@bigdata1 xxxx]# python test.pyrnTraceback (most recent call last):rn File "test.py", line 3, in rn import virtkeyrnImportError: No module named virtkey
ImportError: No module named nose_parameterized
在学习Theano的过程中,为什么仅仅是from theano import sparse就出现这个错误
No module named torch
1.从github上下载了ganomaly,准备看下效果,但在运行run_mnist.sh 命令时报错,具体报错信息如下:rn![图片说明](https://img-ask.csdn.net/upload/201906/03/1559565938_754898.png)rnrnrnrnrnrn2.运行.sh文件报错之后验证了pytorch,torch,torchvision,没有问题。rnrn3.之后也单独重新安装了torch,但是还是报同样的错误。
ImportError: No module named 'sklearn.model_selection'
环境:win10 anaconda3 ,python 3.5 rn问题:在jupyter notebook 中使用sklearn库时,报错:[color=#FF0000][b]ImportError: No module named 'sklearn.model_selection'[/b][/color]rn详细信息如图1所示:rn[align=center][img=https://img-bbs.csdn.net/upload/201707/05/1499261489_576021.png][/img][/align]rn[align=center]图1[/align]rn按照wisdom_bo博客所说在Anaconda prompty 输入:conda update scikit-learn来更新sklearn库。但是在unlinking packages的时候一直没有进度,电脑有网。如图2所示:rn[align=center][img=https://img-bbs.csdn.net/upload/201707/05/1499261686_557725.png][/img][/align]rn[align=center]图2[/align]rn请问大神这是怎么回事啊,我等了好久,大概一个小时也没有反应,即使包再大等一个小时总有进度吧,请求支援!!谢谢谢谢能有人解答!
no module named basehttpserver
我的Python版本是3.4,在运行standalone.py的时候,遇上这样的错误:rnno module named basehttpserverrn自己也查看了当前目录下的文件,确实没有basehttpServer。请问如何获取BaseHTTPServer,是不是需要下载什么?rnrn错误代码:rnTraceback (most recent call last):rn File "D:\Program Files\app\pywebsocket\pywebsocket-master\mod_pywebsocket\standalone.py", line 159, in rn from BaseHTTPServer import BaseHTTPRequestHandlerrnImportError: No module named 'BaseHTTPServer'rnrn目录文件截图:rn[img=https://img-bbs.csdn.net/upload/201611/26/1480164708_47958.png][/img]
No module named helloworld
怎么解决 ,
ImportError: No module named os
我在配置Apache+mod_wsgi+Django的过程中,出现错误rn[Tue Sep 28 23:03:56 2010] [error] Traceback (most recent call last):rn[Tue Sep 28 23:03:56 2010] [error] File "E:/devspace/djtest/djtest/django.wsgi", line 1, in rn[Tue Sep 28 23:03:56 2010] [error] import sys, osrn[Tue Sep 28 23:03:56 2010] [error] ImportError: No module named osrnrn同样的工程,我在公司跑没问题,在家就出现这问题。rn有了解的告诉下,谢谢!
ImportError: No module named httplib
使用python编写脚本,提示ImportError: No module named httplib,在网上搜了下说是需要导入Django。我就在python官网上下了Django-1.6.1.tar.gz安装后,还是提示没有httplib,现在真不知道该怎么办了,请高手帮忙解决下
ImportError: No module named 请教
目录结构rnSrcrn |_MyApprn |_ MyApp.pyrn |_ MyFrame.pyrn |_ __init__.pyrnrn#MyApp.pyrnimport wxrnfrom MyApp.MyFrame import MyFrame rn#from MyFrame import MyFramernclass MyApp(wx.App):rn def __init__(self):rn wx.App.__init__(self)rn def OnInit(self):rn self.frame = MyFrame(None)rn self.frame.Show(True)rn self.SetTopWindow(self.frame) rn return Truernrnif __name__=="__main__":rn app = MyApp() rn app.MainLoop() rnrn运行时提示 ImportError: No module named iCMSApp.MainFramern请教下大家
No module named cElementTree
各位大虾,虾米初学linux,请问下面是什么问题,我是在ubuntu8.04上面运行yum命令出现的问题:rnrnrnThere was a problem importing one of the Python modulesrnrequired to run yum. The error leading to this problem was:rnrn No module named cElementTreernrnPlease install a package which provides this module, orrnverify that the module is installed correctly.rnrnIt's possible that the above module doesn't match therncurrent version of Python, which is:rn2.5.2 (r252:60911, Apr 21 2008, 11:12:42)rn[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)]rnrnIf you cannot solve this problem yourself, please send thisrnmessage to .
ImportError: No module named sets
谁值得这个是什么错误啊rnTraceback (most recent call last):rn File "/usr/local/mpich2/bin/mpd", line 87, in ?rn from sets import Set as setrnImportError: No module named setsrn帮忙指点一下
ImportError: No module named fcntl
ImportError: No module named fcntl #fcntl.py #ImportError
ImportError: No module named '_pywrap_tensorflow_internal'
tensorflow==1.5.0 安装成功;继续安装gpu版本,按系统提示再安装 CUDA-9.0, cuDNN-7.0: cuda_9.0.176_win10_network以及patch1-4 / cudnn-9.0-windows10-x64-v7.3.1.20. 运行‘import tensorflow as tf’后报错: ImportError: No module named '_pywrap_tensorflow_internal'rnrn谢谢帮助rnrn ---------------------------------------------------------------------------rnImportError Traceback (most recent call last)rnC:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()rn 17 try:rn---> 18 return importlib.import_module(mname)rn 19 except ImportError:rnrnC:\Program Files\Anaconda3\lib\importlib\__init__.py in import_module(name, package)rn 125 level += 1rn--> 126 return _bootstrap._gcd_import(name[level:], package, level)rn 127 rnrnC:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _gcd_import(name, package, level)rnrnC:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _find_and_load(name, import_)rnrnC:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _find_and_load_unlocked(name, import_)rnrnC:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _load_unlocked(spec)rnrnC:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in module_from_spec(spec)rnrnC:\Program Files\Anaconda3\lib\importlib\_bootstrap_external.py in create_module(self, spec)rnrnC:\Program Files\Anaconda3\lib\importlib\_bootstrap.py in _call_with_frames_removed(f, *args, **kwds)rnrnImportError: DLL load failed: 找不到指定的程序。rnrnDuring handling of the above exception, another exception occurred:rnrnImportError Traceback (most recent call last)rnC:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in ()rn 57 rn---> 58 from tensorflow.python.pywrap_tensorflow_internal import *rn 59 from tensorflow.python.pywrap_tensorflow_internal import __version__rnrnC:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in ()rn 20 return importlib.import_module('_pywrap_tensorflow_internal')rn---> 21 _pywrap_tensorflow_internal = swig_import_helper()rn 22 del swig_import_helperrnrnC:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py in swig_import_helper()rn 19 except ImportError:rn---> 20 return importlib.import_module('_pywrap_tensorflow_internal')rn 21 _pywrap_tensorflow_internal = swig_import_helper()rnrnC:\Program Files\Anaconda3\lib\importlib\__init__.py in import_module(name, package)rn 125 level += 1rn--> 126 return _bootstrap._gcd_import(name[level:], package, level)rn 127 rnrnImportError: No module named '_pywrap_tensorflow_internal'rnrnDuring handling of the above exception, another exception occurred:rnrnImportError Traceback (most recent call last)rn in ()rn----> 1 import tensorflow as tfrnrnC:\Program Files\Anaconda3\lib\site-packages\tensorflow\__init__.py in ()rn 22 rn 23 # pylint: disable=wildcard-importrn---> 24 from tensorflow.python import *rn 25 # pylint: enable=wildcard-importrn 26 rnrnC:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\__init__.py in ()rn 47 import numpy as nprn 48 rn---> 49 from tensorflow.python import pywrap_tensorflowrn 50 rn 51 # Protocol buffersrnrnC:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py in ()rn 72 for some common reasons and solutions. Include the entire stack tracern 73 above this error message when asking for help.""" % traceback.format_exc()rn---> 74 raise ImportError(msg)rn 75 rn 76 # pylint: enable=wildcard-import,g-import-not-at-top,unused-import,line-too-longrnrnImportError: Traceback (most recent call last):rn File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 18, in swig_import_helperrn return importlib.import_module(mname)rn File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_modulern return _bootstrap._gcd_import(name[level:], package, level)rn File "", line 986, in _gcd_importrn File "", line 969, in _find_and_loadrn File "", line 958, in _find_and_load_unlockedrn File "", line 666, in _load_unlockedrn File "", line 577, in module_from_specrn File "", line 906, in create_modulern File "", line 222, in _call_with_frames_removedrnImportError: DLL load failed: 找不到指定的程序。rnrnDuring handling of the above exception, another exception occurred:rnrnTraceback (most recent call last):rn File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow.py", line 58, in rn from tensorflow.python.pywrap_tensorflow_internal import *rn File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 21, in rn _pywrap_tensorflow_internal = swig_import_helper()rn File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\pywrap_tensorflow_internal.py", line 20, in swig_import_helperrn return importlib.import_module('_pywrap_tensorflow_internal')rn File "C:\Program Files\Anaconda3\lib\importlib\__init__.py", line 126, in import_modulern return _bootstrap._gcd_import(name[level:], package, level)rnImportError: No module named '_pywrap_tensorflow_internal'rnrnrnFailed to load the native TensorFlow runtime.rnrnSee https://www.tensorflow.org/install/install_sources#common_installation_problemsrnrnfor some common reasons and solutions. Include the entire stack tracernabove this error message when asking for help.
ImportError: No module named django.db
#-*- coding:utf-8 -*-rnrnfrom django.db import modelsrnrnclass Topics(models.Model):rn """用户学习的主题"""rn text = models.CharField(max_length=200)rn date_added = models.DateTimeField(auto_now_add=ture)rnrn def __str__(self):rn """返回模型的字符串表示"""rn return self.text
module named ‘XXX’问题解决方法
解决方法一: 打开Anaconda Prompt,输入命令: conda install XXX 解决方法二: 如果上述方法提示PackagesNotFoundError,那么就用pip安装,命令是: pip install XXX 注意!!!!如果在conda中创建了envs如tensorflow,那么需要进入对应环境进行安装。以scipy为例,操作如下: 打开Anaconda P...
No module named distutils.core
DistributionMetadata instance has no attributern
python:no module named MySQLdb
想用django开发网站。使用的是python2.7,操作系统win10.已经安装好了Anaconda和mysql。现在想进行连接数据库,已经在网站下载并安装了多个版本的python-mysql驱动(1.2.3版本等),然后再import MySQLdb,还是提示no module named MySQLdbrnrnrn在C:\Anaconda2\Lib\site-packages也已经有了C:\Anaconda2\Lib\site-packages\MySQL_python-1.2.3-py2.7.egg-info和C:\Anaconda2\Lib\site-packages\MySQLdb。rnrn为什么就是不能成功呢?rnrndjango在启动服务的时候,错误为:rnC:\Anaconda2\Django-1.9.4\django\bin\hello>python manage.py runsever 0.0.0.0:8080rnTraceback (most recent call last):rn File "manage.py", line 10, in rn execute_from_command_line(sys.argv)rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\core\management\__init__.py", line 353, in execute_from_command_linern utility.execute()rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\core\management\__init__.py", line 327, in executern django.setup()rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\__init__.py", line 18, in setuprn apps.populate(settings.INSTALLED_APPS)rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\apps\registry.py", line 108, in populatern app_config.import_models(all_models)rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\apps\config.py", line 202, in import_modelsrn self.models_module = import_module(models_module_name)rn File "F:\Anaconda\lib\importlib\__init__.py", line 37, in import_modulern __import__(name)rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\contrib\auth\models.py", line 4, in rn from django.contrib.auth.base_user import AbstractBaseUser, BaseUserManagerrn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\contrib\auth\base_user.py", line 49, in rn class AbstractBaseUser(models.Model):rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\db\models\base.py", line 108, in __new__rn new_class.add_to_class('_meta', Options(meta, app_label))rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\db\models\base.py", line 299, in add_to_classrn value.contribute_to_class(cls, name)rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\db\models\options.py", line 263, in contribute_to_classrn self.db_table = truncate_name(self.db_table, connection.ops.max_name_length())rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\db\__init__.py", line 36, in __getattr__rn return getattr(connections[DEFAULT_DB_ALIAS], item)rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\db\utils.py", line 212, in __getitem__rn backend = load_backend(db['ENGINE'])rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\db\utils.py", line 116, in load_backendrn return import_module('%s.base' % backend_name)rn File "F:\Anaconda\lib\importlib\__init__.py", line 37, in import_modulern __import__(name)rn File "F:\Anaconda\lib\site-packages\django-1.9.4-py2.7.egg\django\db\backends\mysql\base.py", line 28, in rn raise ImproperlyConfigured("Error loading MySQLdb module: %s" % e)rndjango.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module: No module named MySQLdb
相关热词 c# login 居中 c# 考试软件 c# 自然语言分析 c# 分段读取文件 c# 泛型反射 c#打断点 c# 时间转多少秒 c# 线程函数加参数 c# modbus 读取 c#查询集合表