草庐IT

Hotel_Name

全部标签

Python 2.7 不再工作 : cannot import name md5

我昨天在我的服务器(ubuntu14.04)上安装了python3.6.3,现在我无法运行python2.7(在虚拟环境和“主环境”中)。我一直在谷歌上寻找这个,但没有成功。我尝试重新安装openssl,因为我是红色的。谁能帮帮我?我要疯了。--->这是我尝试执行python脚本(或pip)时的消息:*ERROR:root:codeforhashmd5wasnotfound.Traceback(mostrecentcalllast):File"/usr/local/lib/python2.7/hashlib.py",line147,inglobals()[__func_name]=__

python - imp.reload - NoneType 对象没有属性 'name'

以下代码:def_IMPORT_(path)path=abspath(path)namespace=path[len(getcwd())+1:].replace('/','_').strip('\\/;,.')print(path)print(namespace)loader=importlib.machinery.SourceFileLoader(namespace,path+'.py')handle=loader.load_module(namespace)print(handle)importlib.reload(handle)returnhandle产生:/home/torxe

python - 为什么在第二次导入时导入错误变为 "cannot import name"?

这是一个神秘的python问题:我正在开发一个python包,偶尔会报告类似ImportError:cannotimportname...的导入错误。一般不能导入的模块是可进口的没有任何循环导入问题(我可以检测到)。我已经能够用这个简单的例子重现类似的效果:mypkg/__init__.py:from.importmodule_ayarg##causeimporterrormypkg/module_a.py:print"importedmodule_a"现在我将尝试导入包两次。请注意,第二次导入时错误发生了变化:>>>importmypkgModuleAimportedTracebac

python - 用户警告 : Pandas doesn't allow columns to be created via a new attribute name

我受困于我的pandas脚本。实际上,我正在处理两个csv文件(一个输入文件和另一个输出文件)。我想复制两列的所有行并进行计算,然后将其复制到另一个数据框(输出文件)。列如下:'lat','long','PHCount','latOffset_1','longOffset_1','PH_Lat_1','PH_Long_1','latOffset_2','longOffset_2','PH_Lat_2','PH_Long_2','latOffset_3','longOffset_3','PH_Lat_3','PH_Long_3','latOffset_4','longOffset_4',

python - 为什么 cls.__name__ 没有出现在 dir() 中?

假设我有一个简单的类:classFoobar(object):pass如果我使用dir(Foobar),我将得到以下输出:['__class__','__delattr__','__dict__','__doc__','__format__','__getattribute__','__hash__','__init__','__module__','__new__','__reduce__','__reduce_ex__','__repr__','__setattr__','__sizeof__','__str__','__subclasshook__','__weakref__']

python - 输入(): "NameError: name ' n' is not defined"

这个问题在这里已经有了答案:input()error-NameError:name'...'isnotdefined(15个答案)关闭6年前。好的,所以我正在用python编写成绩检查代码,我的代码是:unit3Done=str(input("HaveyoudoneyourUnit3ControlledAssessment?(Typeyorn):")).lower()ifunit3Done=="y":passelifunit3Done=="n":print"Sorry.YoumusthavedoneatleastoneunittocalculatewhatyouneedforanA*"

python - Selenium python find_element_by_class_name() 从 v 2.2 到 2.21 停止工作——不能使用 'Compound Class Name'

我正在使用Selenium的python库从Firefox的html页面中抓取数据。我不得不从Selenium2.0更新到2.21,因为服务器已经更新了Firefox。在v2.21中调用find_element_by_class_name("grid-cell-innergrid-col-name")失败:selenium.common.exceptions.WebDriverException:Message:u'Compoundclassnamesnotpermitted'我尝试访问的元素的类名是grid-cell-innergrid-col-name对find_element_b

python - jupyter 抛出错误 : socket. gaierror: [Errno -2] Name or service not known

我在AWSEMR上运行一个pyspark集群,并将Jupyter用于pyspark驱动程序。最近,脚本失败了。Jupiter无法启动服务器。我使用condainstalljupyter安装并使用sudoinitctlstartjupyter启动。集群运行良好。这是服务器的配置值。#jupyterconfigsmkdir-p~/.jupytertouchls~/.jupyter/jupyter_notebook_config.pyHASHED_PASSWORD=$(python-c"fromnotebook.authimportpasswd;print(passwd('$JUPYTER_

python - Satchmo 克隆satchmo.py ImportError : cannot import name execute_manager

我让satchmo尝试,但我在第一次尝试时遇到了一个很大的问题,我不明白哪里出了问题。当我将$pythonclonesatchmo.py制作成清晰的django项目时,它会报错:$pythonclonesatchmo.pyCreatingtheSatchmoApplicationCustomizingthefilesPerforminginitialdatasynchingTraceback(mostrecentcalllast):File"manage.py",line18,infromdjango.core.managementimportexecute_managerImport

python - Tcl 错误 : no display name and no $DISPLAY environment variable on EC2

我想在AmazonEC2(LinuxAMI)上使用iPython。我已经安装了Anaconda并启动了iPython来测试我已经创建的一些脚本。现在我只对在终端中运行它感兴趣(不是作为笔记本)。在我的代码开头,我总是这样做:importjsonimportnumpyasnpimportpandasaspdfrompandasimportSeries,DataFrame但是,我在我的文本编辑器中尝试了CTRL+C,然后在终端中使用%paste我得到了错误:TclError:nodisplaynameandno$DISPLAYenvironmentvariable如果我按照这个建议尝试ss