摘要:在装psycopg2的时候碰到的奇怪问题。error: Setup script exited with error: Unable to find vcvarsall.bat在办公室及其上通过easy_install psycopg2安装psycopg2一切正常,但在家里的机器上按照同样的方法安装却出错,报找不到vcvarsall.bat,真是奇怪。比较了一下,两台机器的唯一区别是办公室机器上装了Visual studio 2008,难道这个有关系?如非特别需要,绝对不会安装Visual studio,microsoft的东西做的是越来越大,越来越臃肿了。总不能为了这么一个小问题就安装庞大的
阅读全文
随笔分类 - python相关
主要包括python各种库的使用
摘要:在windows下使用easy_installpsycopg2安装psycopg2时安装成功,但在python中import psycopg2时却提示如下错误:from psycopg2._psycopg import BINARY, NUMBER, STRING, DATETIME, ROWIDImportError: DLL load failed: 找不到指定的模块。为何?? ImportError: DLL load failed: The specified module could not be found.the file _psycopg.pyd is a dll. For i
阅读全文
摘要:import inspectdef get_current_function_name(): return inspect.stack()[1][3]class MyClass: def function_one(self): print "%s.%s invoked"%(self.__class__.__name__, get_current_function_name())if __name__ == "__main__": myclass = MyClass() myclass.function_one()动态获取当前运行的函数名很方便,特别是对于
阅读全文
摘要:pytest Democonftest.py# -*- coding: utf-8 -*-import threadingimport subprocessimport timeimport pytestdef run_with_timeout(timeout = None): def _decorator(f): def _wrapper(*args, **kwargs): def _f(*args, **kwargs): try: _result = f(*args, **kwargs) except Exception , e: thread._exception = e else: t
阅读全文

浙公网安备 33010602011771号