草庐IT

act_name

全部标签

python - "ImportError: no module named ' 用pip安装后请求'"

我收到ImportError:nomodulenamed'requests'。但我已经使用命令pipinstallrequests安装了requests包。在命令提示符下运行命令pipfreeze,结果为requests==2.7.0那么为什么在运行python文件时会出现这种错误呢? 最佳答案 在命令提示符下运行。piplist如果您有旧版本,请检查您在系统上安装的版本。尝试卸载包...pipuninstallrequests安装后试试:pipinstallrequests您还可以测试pip是否无法完成工作。easy_instal

python - 属性错误 : '_socketobject' object has no attribute 'set_tlsext_host_name'

在python中,在Ubuntu服务器上,我试图让requests库发出https请求,如下所示:importrequestsrequests.post("https://example.com")首先,我得到了以下信息:/usr/local/lib/python2.7/dist-packages/requests/packages/urllib3/util/ssl_.py:90:InsecurePlatformWarning:AtrueSSLContextobjectisnotavailable.Thispreventsurllib3fromconfiguringSSLappropr

python - 导入错误 : cannot import name RAND_egd

我尝试使用py2exe创建一个exe文件。我最近将Python从2.7.7更新到2.7.10,以便能够使用requests-proxies。更新之前一切正常,但现在,最近创建的exe文件引发了这个错误:Traceback(mostrecentcalllast):File"puoka_2.py",line1,inimportmLibFile"mLib.pyc",line4,inFile"urllib2.pyc",line94,inImportError:cannotimportnameRAND_egd它可能可以通过更改setup.py文件中的options来修复,但我不知道我必须在那里写

python - '导入错误 : No module named dumbnet' when trying to run a script that leverages scapy on OS X

因此,我正在尝试了解Python中的scapy库并尝试运行使用scapy的脚本。该脚本使用以下内容导入模块:从scapy.all导入*我看到了这个,当然安装了scapy:pipinstallscapy接下来,我遇到了以下导入错误:ImportError:没有名为pcapy的模块所以,我决定用pipinstallpcapy安装pcapy。它安装正常,但现在我收到以下导入错误:ImportError:没有名为dumbnet的模块我找不到名为dumbnet的模块。有人知道这里发生了什么吗?这是我第一次弄乱scapy并在激活的虚拟环境中使用安装了Python2.7的Mac。编辑1:这是完整的错

python - 如何访问 BeautifulSoup 中名为 "name"的标签

我想访问一个名为"name"的标签,例如:YesügeyYeşil+903339695395由于"name"是BeautifulSoup标签对象的属性,我无法访问子标签name:>>>c1YesügeyYeşil+903339695395>>>c1.name'contact'>>>c1.lastnameYeşil 最佳答案 你可以这样试试,>>>soup=BeautifulSoup.BeautifulSoup(content).findAll('name')>>>forfieldinsoup:...printfield...Yesü

Python 电子邮件模块 : form header "From" with some unicode name + email

我在Python电子邮件模块的帮助下生成电子邮件。这里有几行代码,可以证明我的问题:msg=email.MIMEMultipart.MIMEMultipart('alternative')msg['From']="somemail@somedomain.com"msg.as_string()Out[7]:'Content-Type:multipart/alternative;\nboundary="===============9006870443159801881=="\nMIME-Version:1.0\nFrom:somemail@somedomain.com\n\n--====

python - if __name__ == '__main__' : 的快捷方式

有没有更短的形式?if__name__=='__main__':写起来很乏味,而且在我看来也不太好看:) 最佳答案 PEP299提出了一个解决这个疣的方法,即有一个特殊的函数名__main__。它被拒绝了,部分原因是:Guidopronouncedthathedoesn'tliketheideaanywayasit's"notworththechange(indocs,userhabits,etc.)andthere'snothingparticularlybroken."http://www.python.org/dev/peps

python - 导入caffe导致ImportError : "No module named google.protobuf.internal" (import enum_type_wrapper)

我在我的机器上安装了AnacondaPython。当我启动Python解释器并在Pythonshell中键入“importcaffe”时,出现以下错误:ImportError:Nomodulenamedgoogle.protobuf.internal我有以下文件:wire_format_lite_inl.hwire_format_lite.hwire_format.hunknown_field_set.htext_format.hservice.hrepeated_field.hreflection_ops.hmessage_lite.hmessage.hgenerated_messa

python - 导入错误 : cannot import name _imaging

我安装了Pillow,然后我想做的事:fromPILimportImage我收到以下错误:Traceback(mostrecentcalllast):File"",line1,inFile"/usr/local/lib/python2.7/dist-packages/PIL/Image.py",line61,inImportError:cannotimportname_imaging但是,如果我分别导入这些,一切都很好,即:import_imagingimportImage你知道问题可能是什么吗? 最佳答案 我有同样的问题,我通过使

python - 导入错误 : No module named mime. 多部分

早上好为了测试目的,我做了一个单行的Python程序:fromemail.mime.multipartimportMIMEMultipart当我通过interpeter运行它时,我收到一条可怕的错误消息:fromemail.mime.multipartimportMIMEMultipartImportError:Nomodulenamedmime.multipart我使用的是Python2.4.3版。我怀疑电子邮件模块在中间版本中更改了其包装结构,因此出现错误。我的怀疑是否正确?如果不是,为什么导入语句不起作用?提前致谢,公里数 最佳答案