草庐IT

module_path

全部标签

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 - 如何在 ipython 启动时将目录添加到 sys.path

环境:windows7英文32位python2.7.3ipython0.13.1我试试配置:ipython-i-c"importsys;sys.path.append('path_name')"但是好像不行。那么正确的解决方法是什么?或者如何在ipython启动时将当前目录添加到sys.path?谢谢。 最佳答案 稍微跟进一下Honghe.Wu的回答。有人可能想补充:c.InteractiveShellApp.exec_lines=['importsys;sys.path.append("/absolute/path/")']到ip

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 - 亚马逊 Elastic Beanstalk : how to set the wsgi path?

我从那里的文档练习在ElasticBeanstalk下设置Django。但是有错误。ERRORYourWSGIPathreferstoafilethatdoesnotexist.我的目录是这样的:-djangoenv(whereIusegit)-mysite-manage.py-mysite-__init__.py-settings.py-urls.py-wsgi.py我的.elasticbeanstalk/optionsettings.djapp文件是这样的:还有.ebextensions/python.config这样的,不知道该放哪里,试了几次还是不行。我试了mysite/mys

python - Windows 上的 GeoDjango : Try setting GDAL_LIBRARY_PATH in your settings

我以前这样做过十几次,但这次有些东西不工作..遵循文档:https://docs.djangoproject.com/en/1.11/ref/contrib/gis/install/#windows我正在尝试在Windows机器上设置GeoDjango(这是在paperspace.com上设置的虚拟Windows10)。我的PATH设置似乎有问题,但我无法弄清楚它是什么。我已经运行了说明中突出显示的命令。我检查了我的PATH变量,一切似乎都正常。我已经尝试将它们指向OSGeo4Win的32位和64位版本。无论如何,我每次都会得到以下输出:C:\Python\lib\site-packa

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