草庐IT

kotlin_module

全部标签

python - Web.py - 属性错误 : 'module' object has no attribute 'application'

我使用web.py编写了一个小的helloworld站点,但是当我运行pythoncode.py时,我收到一条错误消息:Traceback(mostrecentcalllast):File"E:\Python25\webpy\web\mysite.py",line1,inimportwebFile"E:\Python25\webpy\web\web.py",line4,inapp=web.application(urls,globals())AttributeError:'module'objecthasnoattribute'application'这是我的代码(从web.py的教程

python - 属性错误 : module 'mysql' has no attribute 'connector'

我正在运行Ubuntu16.04,尝试在python中连接到mysql:importmysqlusername='root'cnx=mysql.connector.connect(user=username,database='db')cnx.close()但是我得到一个错误:File"pysql1.py",line4,incnx=mysql.connector.connect(user=username,database='db')AttributeError:module'mysql'hasnoattribute'connector'我通过下载包安装了mysqlpython模块he

python - 适当的相对进口 : "Unable to import module"

我有一个结构如下的项目:.└──myapp  ├──app.py  ├──models  │  ├──hello.py  │  └──world.py  └──requirements.txt我有两个模型,hello和world。这两个模型都是从app.py中使用的,我在其中像这样导入它们:frommodels.helloimportHellofrommodels.worldimportWorld但是world也需要用到hello。我在world.py中试过这个:frommodels.helloimportHello当我运行应用程序时,上面的技术在技术上是有效的,但是VSCode的Py

python - 导入错误 : No module named 'yaml'

我有一个脚本正在尝试执行python3env/common_config/add_imagepullsecret.py但是,我收到以下错误:[root@kevin]#python3env/common_config/add_imagepullsecret.pyTraceback(mostrecentcalllast):File"env/common_config/add_imagepullsecret.py",line4,inimportyamlImportError:Nomodulenamed'yaml'[root@kevin]#pip3installpyyamlRequiremen

python - numpy 属性错误 : with theano module 'numpy.core.multiarray' has no attribute _get_ndarray_c_version

我正在运行这个简单的例子:importtheanox=theano.tensor.dscalar()f=theano.function([x],2*x)f(4)我得到:AttributeError:('Thefollowingerrorhappenedwhilecompilingthenode',Elemwise{mul,no_inplace}(TensorConstant{2.0},),'\n',"module'numpy.core.multiarray'hasnoattribute'_get_ndarray_c_version'")我认为这一定是一个numpy错误,所以我尝试更新,

python - 导入错误 : No module named pexpect

我正在使用Fabric并且想使用fexpect。我有以下Python脚本:fromilogue.fexpectimportexpect,expecting,run(...)definstall_postgresql(profile):print("!!!InstallingPostgreSQL...")print('->Doingpre-cleanup...')#RemovePostgreSQLifitexistsprompts=[]prompts+=expect('Doyouwanttocontinue[Y/n]?','Y')withsettings(warn_only=True):

python - Werkzeug 属性错误 : 'module' object has no attribute 'InteractiveInterpreter'

尝试使用app.run(debug=True)运行代码时,使用Flask(0.8)和Werkzeug(0.8.1)我收到下面描述的错误。使用app.run()时没有报错错误Traceback(mostrecentcalllast):File"code2.py",line9,inapp.run(debug=True)File"//env/lib/python2.7/site-packages/Flask-0.8-py2.7.egg/flask/app.py",line703,inrunrun_simple(host,port,self,**options)File"//env/lib/p

python - 为什么会出现 TypeError : 'module' object is not callable when trying to import the random module?

我正在使用Python2.6并尝试运行一个简单的随机数生成器程序(random.py):importrandomforiinrange(5):#randomfloat:0.0我现在收到以下错误:C:\Users\Developer\Documents\PythonDemo>pythonrandom.pyTraceback(mostrecentcalllast):File"random.py",line3,inimportrandomFile"C:\Users\Developer\Documents\PythonDemo\random.py",line8,inprintrandom.ra

python - 导入 pyplot,运行时错误 : Cannot dlopen tkinter module file

我使用pyenv在windowsbash中安装pypy,然后使用pip安装matplotlib,但是当导入pyplot时,我得到了一个运行时错误In[1]:importmatplotlib.pyplotasplt---------------------------------------------------------------------------RuntimeErrorTraceback(mostrecentcalllast)in()---->1importmatplotlib.pyplotasplt/home/zjshao/.pyenv/versions/pypy-5.

python - 如何组织GAE Modules app结构和代码?

我有一些GAE应用程序,我想将它们分为三个模块:default(www)、mobile和api但我在理解模块和如何组织代码时遇到了一些困难。根据图片找到here这就是应用程序的外观。这是我到目前为止想出的简化结构:gae-app/├──modules│  ├──api│  │  ├──app.yaml│  │  └──src│  │  └──main.py│  ├──mobile│  │  ├──app.yaml│  │  └──src│  │  └──index.html│  └──www│  ├──app.yaml│  └──src│  ├──main.py│  └──templa