本文整理汇总了Python中pyutilib.misc.Options.environment['shell+path']方法的典型用法代码示例。如果您正苦于以下问题:Python Options.environment['shell+path']方法的具体用法?Python Options.environment['shell+path']怎么用?Python Options.environment['shell+path']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyutilib.misc.Options
的用法示例。
在下文中一共展示了Options.environment['shell+path']方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: help_environment
# 需要导入模块: from pyutilib.misc import Options [as 别名]
# 或者: from pyutilib.misc.Options import environment['shell+path'] [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))