草庐IT

cm-attribute

全部标签

python - 属性错误 : 'module' object has no attribute 'plt' - Seaborn

我对这些库非常陌生,并且在绘制时遇到了麻烦:importpandasaspdimportseabornassnsimportmatplotlib.pyplotaspltimportnumpyasnpimportrandomdf5=pd.read_csv('../../../../datos/tiempos-exacto-variando-n-m0.csv',sep=',',engine='python')print(df5)df5['n']=df5['n'].apply(lambdax:x**2)sns.jointplot(df5['n'],df5['tiempoTotal'],kin

python - 开始 celery : AttributeError: 'module' object has no attribute 'celery'

我尝试从命令行启动Celery工作服务器:celery-Atasksworker--loglevel=infotasks.py中的代码:importosos.environ['DJANGO_SETTINGS_MODULE']="proj.settings"fromceleryimporttask@task()defadd_photos_task(lad_id):...我得到下一个错误:Traceback(mostrecentcalllast):File"/usr/local/bin/celery",line8,inload_entry_point('celery==3.0.12','c

python - pip 差错误 : 'module' object has no attribute 'Cryptography_HAS_SSL_ST'

我尝试从pip安装并不断收到类似类型的错误。$pipinstallquandlTraceback(mostrecentcalllast):File"/usr/bin/pip",line9,inload_entry_point('pip==1.5.6','console_scripts','pip')()File"/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py",line558,inload_entry_pointreturnget_distribution(dist).load_entry_point(group,n

python - 属性错误 : StringIO instance has no attribute 'fileno'

defcaptureOutput(self,func,*args,**kwargs):passsys.stdout.flush()sys.stderr.flush()(outfd,fn)=tempfile.mkstemp()fout=os.fdopen(outfd,'r')os.unlink(fn)(errfd,fn)=tempfile.mkstemp()ferr=os.fdopen(errfd,'r')os.unlink(fn)try:oldstdout=os.dup(sys.stdout.fileno())oldstderr=os.dup(sys.stderr.fileno())o

python - 刮痧 : AttributeError: 'list' object has no attribute 'iteritems'

这是我关于堆栈溢出的第一个问题。最近想用linked-in-scraper,所以我下载并指示“scrapycrawllinkedin.com”并收到以下错误消息。供您引用,我使用anaconda2.3.0和python2.7.11。所有相关的包,包括scrapy和六个,都是在执行程序之前通过pip更新的。Traceback(mostrecentcalllast):File"/Users/byeongsuyu/anaconda/bin/scrapy",line11,insys.exit(execute())File"/Users/byeongsuyu/anaconda/lib/pytho

python - 属性错误 : 'list' object has no attribute 'encode'

我有一个unicode对象列表,想将它们编码为utf-8,但编码似乎不起作用。代码在这里:>>>tmp=[u'testcontext']>>>tmp.encode('utf-8')Traceback(mostrecentcalllast):File"",line1,inAttributeError:'list'objecthasnoattribute'encode'>>>我不明白为什么没有属性编码 最佳答案 您需要在tmp[0]上进行encode,而不是在tmp上。tmp不是字符串。它包含一个(Unicode)字符串。尝试运行typ

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

当我运行我的python代码时importnumpyasnpimportcv2importmatplotlib.pyplotaspltimg1=cv2.imread('/home/shar/home.jpg',0)#queryImageimg2=cv2.imread('/home/shar/home2.jpg',0)#trainImage#InitiateSIFTdetectororb=cv2.ORB()#findthekeypointsanddescriptorswithSIFTkp1,des1=orb.detectAndCompute(img1,None)kp2,des2=orb.

Python类继承: AttributeError: '[SubClass]' object has no attribute 'xxx'

我有以下基类和子类:classEvent:def__init__(self,sr1=None,foobar=None):self.sr1=sr1self.foobar=foobarself.state=STATE_NON_EVENT#EventclasswrapperstoprovidesyntaticsugarclassTypeTwoEvent(Event):def__init__(self,level=None):self.sr1=levelself.state=STATE_EVENT_TWO在我的代码中,我正在检查TypeTwoEvent类的实例,检查我知道基类中存在的字段-我希

Python Selenium : Find object attributes using xpath

我是xpath的新手,正在尝试使用xpath获取“值”的值:虽然通过"type="submit"很容易找到元素,例如:browser.find_elements_by_xpath("//*[@type='submit']")我一直无法弄清楚如何获得我需要的值,如:browser.find_elements_by_xpath("//*[@type='submit']/@value")有点出乎意料地给出了一个错误:expression"//*[@type=\'submit\']/@value"is:[objectAttr].Itshouldbeanelement有什么办法解决这个问题吗?编

mongodb - Hyperopt mongotrials 问题与 Pickle : AttributeError: 'module' object has no attribute

我正在尝试在MongoDB中使用Hyperopt并行搜索,但在使用Mongotrials时遇到了一些问题,已讨论here.我已经尝试了他们所有的方法,但我仍然无法找到解决我的具体问题的方法。我试图最小化的具体模型是来自sklearn的RadomForestRegressor。我关注了tutorial.而且我可以毫无问题地打印出计算出的“fmin”。这是我目前的步骤:1)激活一个名为“tensorflow”的虚拟环境(我已经在那里安装了我所有的库)2)启动MongoDB:(tensorflow)bash-3.2$mongod--dbpath.--port1234--directorype