草庐IT

PART_NAME

全部标签

python - Django 1.7 - App 'your_app_name' 没有迁移

我正在尝试从Django1.6.7升级到Django1.7.1,所以我一直在尝试迁移我的应用程序。我已经关注了djangodocshere.我从已安装的应用程序中删除了南方。在迁移目录中,我删除了编号的迁移文件和.pyc文件,但我保留了目录和__init__.py文件。然后我运行:pythonmanage.pymakemigrationsyour_app_name我收到以下确认消息:Migrationsfor'your_app_name':0001_initial.py:-CreatemodelUserProfile接下来我运行:pythonmanage.pymigrateyour_a

python - main 函数和/或 __name__ == "__main__"在 Python 中检查有什么意义?

这个问题在这里已经有了答案:Whatdoesif__name__=="__main__":do?(43个回答)关闭3个月前。我偶尔会在Python脚本中注意到类似以下内容:if__name__=="__main__":#dostufflikecallmain()这是什么意思?

python - main 函数和/或 __name__ == "__main__"在 Python 中检查有什么意义?

这个问题在这里已经有了答案:Whatdoesif__name__=="__main__":do?(43个回答)关闭3个月前。我偶尔会在Python脚本中注意到类似以下内容:if__name__=="__main__":#dostufflikecallmain()这是什么意思?

python - 为什么我得到 "NameError: global name ' open' is not defined"in __del__?

我在类的__del__函数中遇到NameError。我不明白为什么在函数__del__中无法访问“open”。我正在使用Python3.4.0Python代码:classContoller:...def__del__(self):store={}...pickle.dump(store,open('data.p','wb'))classMyWindow(Gtk.Window):def__init__(self):...self.controller=Contoller(self)...self.connect("delete-event",self.quit)......defquit

python - 为什么我得到 "NameError: global name ' open' is not defined"in __del__?

我在类的__del__函数中遇到NameError。我不明白为什么在函数__del__中无法访问“open”。我正在使用Python3.4.0Python代码:classContoller:...def__del__(self):store={}...pickle.dump(store,open('data.p','wb'))classMyWindow(Gtk.Window):def__init__(self):...self.controller=Contoller(self)...self.connect("delete-event",self.quit)......defquit

python - 为什么 python 实例没有 __name__ 属性?

>>>classFoo:...'itisaexample'...print'iamhere'...iamhere>>>Foo.__name__'Foo'>>>Foo().__name__Traceback(mostrecentcalllast):File"",line1,inAttributeError:Fooinstancehasnoattribute'__name__'>>>Foo.__doc__'itisaexample'>>>Foo().__doc__'itisaexample'>>>Foo.__dict__{'__module__':'__main__','__doc__':

python - 为什么 python 实例没有 __name__ 属性?

>>>classFoo:...'itisaexample'...print'iamhere'...iamhere>>>Foo.__name__'Foo'>>>Foo().__name__Traceback(mostrecentcalllast):File"",line1,inAttributeError:Fooinstancehasnoattribute'__name__'>>>Foo.__doc__'itisaexample'>>>Foo().__doc__'itisaexample'>>>Foo.__dict__{'__module__':'__main__','__doc__':

python - 导入错误 : cannot import name cbook

>>>importmatplotlibTraceback(mostrecentcalllast):File"",line1,inFile"/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py",line123,infrom.importcbookImportError:cannotimportnamecbook我没有找到解决方案,有人可以帮忙吗? 最佳答案 1.尝试更新matplotlibpython-mpipinstall-Umatplotlib2.尝试重新安装

python - 导入错误 : cannot import name cbook

>>>importmatplotlibTraceback(mostrecentcalllast):File"",line1,inFile"/usr/local/lib/python2.7/dist-packages/matplotlib/__init__.py",line123,infrom.importcbookImportError:cannotimportnamecbook我没有找到解决方案,有人可以帮忙吗? 最佳答案 1.尝试更新matplotlibpython-mpipinstall-Umatplotlib2.尝试重新安装

python - 从 。导入_方法 ImportError : cannot import name '_methods' in cx-freeze python

exe使用cx-freeze成功构建。但是当我执行exe文件时它显示以下错误:from.import_methodsImportError:cannotimportname'_methods' 最佳答案 这个问题已经在这里回答:WhyamIgettingthisImportError?但为了完整起见,这里是针对这种特定情况的答案:cx_freeze未导入可选模块_method,因此您必须明确告诉他这样做。additional_mods=['numpy.core._methods','numpy.lib.format']setup(n