草庐IT

rel-attribute

全部标签

Windows : AttributeError: Can't get attribute "abc" 上 Jupyter 中的 python 多处理

我正在尝试运行一个简单的命令,该命令使用多处理按名称猜测性别。此代码在以前的机器上运行,所以可能与我的设置有关。下面是我的多处理代码:importsysimportgender_guesser.detectorasgenderimportmultiprocessingimporttimed=gender.Detector()defguess_gender(name):n=name.title()#makefirstletteruppercaseandtherestlowercaseg=d.get_gender(n)#guessgenderreturngls=['john','joe',

python - urllib 模块错误!属性错误 : 'module' object has no attribute 'request'

我目前正在使用python中的“urllib”模块,并尝试使用它来提取网站的源代码:importurllibtemp=urllib.request.urlopen('https://www.quora.com/#')但是,我收到以下错误:Traceback(mostrecentcalllast):File"",line1,intemp=urllib.request.urlopen('https://www.quora.com/#')AttributeError:'module'objecthasnoattribute'request'顺便说一句,我正在使用Python2.7.5。

python - 属性错误 : module 'tensorflow' has no attribute 'reset_default_graph'

我已经安装了tensorflow版本r0.11。在我的文件名cartpole.py中,我导入了tensorflow:importtensorflowastf并使用它:tf.reset_default_graph()尝试在PyCharm中运行我的项目时出现此错误:intf.reset_default_graph()AttributeError:module'tensorflow'hasnoattribute'reset_default_graph'我该如何修复这个错误? 最佳答案 此功能已弃用。请改用tf.compat.v1.rese

python - 属性错误 : 'UUID' object has no attribute 'replace' when using backend-agnostic GUID type

我想在使用SQLAlchemy1.1.5的Postgresql数据库中拥有一个类型为uuid的主键ID,并使用pg8000适配器连接到数据库。我用了Backend-agnosticGUIDTyperecipe来自SQLAlchemy文档。当我想插入数据库时​​,出现如下错误File".../guid.py",line???,inprocess_result_valuereturnuuid.UUID(value)File"/usr/lib/python2.7/uuid.py",line131,in__init__hex=hex.replace('urn:','').replace('uu

python - Django 错误 : "' ChoiceField' object has no attribute 'is_hidden' "

Django模板在呈现时抛出“AttributeError”。我想要实现的是,在模板中,解析的表单将包含一个选择框,其中包含以下列表中的值。这是Forms.py文件:classCallForm(forms.ModelForm):classMeta():model=Callwidgets={'employee_id':forms.ChoiceField(choices=FormsTools.EmployeesToTuples(Employee.objects.all()))}解释:FormsTools.EmployeesToTuples(Employee.objects.all())--

python - 'numpy.float6 4' object has no attribute ' translate' 在 Python 中向 Mysql 插入值

importdatasetdb=dataset.connect(....)table=db[...]当我尝试向Mysql表中插入一些值时,发生了这个错误。我要插入到表中的示例值:print("Buy",ticker,price,date,OType,OSize)BuyAAPL93.43571428572016-05-12Market200data=dict(Order_Side='Buy',Ticker=ticker,Price=price,Order_Date=date,Order_Type=OType,Volume=OSize)table.insert(data)错误信息:Trac

Python httplib2, 属性错误 : 'set' object has no attribute 'items'

我正在玩Python库httplib2.以下是我的代码。importurllib.parseimporthttplib2httplib2.debuglevel=1http=httplib2.Http()url="http://login.sina.com.cn/hd/signin.php"body={"act":"1","entry":"vblog","password":"P@$sW0rd","reference":"http://vupload.you.video.sina.com.cn/u.php?m=1&cate=0","reg_entry":"vblog","remLogin

python - 属性错误 : 'module' object has no attribute 'PROTOCOL_TLSv1_2' with Python 2. 7.11

我在为mac上的python安装获取tlsv1.2支持时遇到问题。这是我的openssl版本:opensslversionOpenSSL1.0.2h3May2016这是我的python版本:python--versionPython2.7.11这就是我正在测试的方式:>>>importssl>>>ssl.PROTOCOL_TLSv1_2Traceback(mostrecentcalllast):File"",line1,inAttributeError:'module'objecthasnoattribute'PROTOCOL_TLSv1_2'正在阅读:https://docs.pyt

python - 属性错误 : module 'tensorflow.contrib.learn' has no attribute 'TensorFlowDNNClassifier'

这是我要执行的mltensorflow代码-importtensorflow.contrib.learnasskflowfromsklearnimportdatasets,metricsiris=datasets.load_iris()classifier=skflow.TensorFlowDNNClassifier(hidden_units=[10,20,10],n_classes=3)classifier.fit(iris.data,iris.target)score=metrics.accuracy_score(iris.target,classifier.predict(iri

android - 运行时异常 : Your content must have a ListView whose id attribute is 'android.R.id.list'

我遇到了运行时异常java.lang.RuntimeException:YourcontentmusthaveaListViewwhoseidattributeis'android.R.id.list'我不知道怎么了。@OverridepublicvoidonCreate(BundlesavedInstanceState){super.onCreate(savedInstanceState);setContentView(R.layout.newslist);mDbHelper.open();fillData();}privatevoidfillData(){Bundleextras=