本文整理匯總了Python中pyutilib.misc.Options.python方法的典型用法代碼示例。如果您正苦於以下問題:Python Options.python方法的具體用法?Python Options.python怎麽用?Python Options.python使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類pyutilib.misc.Options
的用法示例。
在下文中一共展示了Options.python方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: help_environment
# 需要導入模塊: from pyutilib.misc import Options [as 別名]
# 或者: from pyutilib.misc.Options import python [as 別名]
def help_environment():
cmddir = os.path.dirname(os.path.abspath(sys.executable))+os.sep
info = Options()
#
info.python = Options()
info.python.version = '%d.%d.%d' % sys.version_info[:3]
info.python.executable = sys.executable
info.python.platform = sys.platform
try:
packages = []
import pip
for package in pip.get_installed_distributions():
packages.append( Options(name=package.project_name, version=package.version) )
info.python.packages = packages
except:
pass
#
info.environment = Options()
path = os.environ.get('PATH', None)
if not path is None:
info.environment['shell path'] = path.split(os.pathsep)
info.environment['python path'] = sys.path
#
print('#')
print('# Information About the Python and Shell Environment')
print('#')
print(str(info))