本文整理匯總了Python中gym.error.DependencyNotInstalled方法的典型用法代碼示例。如果您正苦於以下問題:Python error.DependencyNotInstalled方法的具體用法?Python error.DependencyNotInstalled怎麽用?Python error.DependencyNotInstalled使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類gym.error
的用法示例。
在下文中一共展示了error.DependencyNotInstalled方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: from gym import error [as 別名]
# 或者: from gym.error import DependencyNotInstalled [as 別名]
def __init__(self, output_path, frame_shape, frames_per_sec):
self.proc = None
self.output_path = output_path
# Frame shape should be lines-first, so w and h are swapped
h, w, pixfmt = frame_shape
if pixfmt != 3 and pixfmt != 4:
raise error.InvalidFrame("Your frame has shape {}, but we require (w,h,3) or (w,h,4), i.e. RGB values for a w-by-h image, with an optional alpha channl.".format(frame_shape))
self.wh = (w,h)
self.includes_alpha = (pixfmt == 4)
self.frame_shape = frame_shape
self.frames_per_sec = frames_per_sec
if distutils.spawn.find_executable('avconv') is not None:
self.backend = 'avconv'
elif distutils.spawn.find_executable('ffmpeg') is not None:
self.backend = 'ffmpeg'
else:
raise error.DependencyNotInstalled("""Found neither the ffmpeg nor avconv executables. On OS X, you can install ffmpeg via `brew install ffmpeg`. On most Ubuntu variants, `sudo apt-get install ffmpeg` should do it. On Ubuntu 14.04, however, you'll need to install avconv with `sudo apt-get install libav-tools`.""")
self.start()
示例2: __init__
# 需要導入模塊: from gym import error [as 別名]
# 或者: from gym.error import DependencyNotInstalled [as 別名]
def __init__(self, final_path, frame_shape, frames_per_sec):
self.proc = None
self.final_path = final_path
_, self.output_path = tempfile.mkstemp(suffix='.mp4')
# Frame shape should be lines-first, so w and h are swapped
h, w, pixfmt = frame_shape
if pixfmt != 3 and pixfmt != 4:
raise error.InvalidFrame("Your frame has shape {}, but we require (w,h,3) or (w,h,4), i.e. RGB values for a w-by-h image, with an optional alpha channl.".format(frame_shape))
self.wh = (w,h)
self.includes_alpha = (pixfmt == 4)
self.frame_shape = frame_shape
self.frames_per_sec = frames_per_sec
if distutils.spawn.find_executable('avconv') is not None:
self.backend = 'avconv'
elif distutils.spawn.find_executable('ffmpeg') is not None:
self.backend = 'ffmpeg'
else:
raise error.DependencyNotInstalled("""Found neither the ffmpeg nor avconv executables. On OS X, you can install ffmpeg via `brew install ffmpeg`. On most Ubuntu variants, `sudo apt-get install ffmpeg` should do it. On Ubuntu 14.04, however, you'll need to install avconv with `sudo apt-get install libav-tools`.""")
self.start()
示例3: __init__
# 需要導入模塊: from gym import error [as 別名]
# 或者: from gym.error import DependencyNotInstalled [as 別名]
def __init__(self, output_path, frame_shape, frames_per_sec):
self.proc = None
self.output_path = output_path
# Frame shape should be lines-first, so w and h are swapped
h, w, pixfmt = frame_shape
if pixfmt != 3 and pixfmt != 4:
raise error.InvalidFrame("Your frame has shape {}, but we require (w,h,3) or (w,h,4), i.e., RGB values for a w-by-h image, with an optional alpha channel.".format(frame_shape))
self.wh = (w,h)
self.includes_alpha = (pixfmt == 4)
self.frame_shape = frame_shape
self.frames_per_sec = frames_per_sec
if distutils.spawn.find_executable('avconv') is not None:
self.backend = 'avconv'
elif distutils.spawn.find_executable('ffmpeg') is not None:
self.backend = 'ffmpeg'
else:
raise error.DependencyNotInstalled("""Found neither the ffmpeg nor avconv executables. On OS X, you can install ffmpeg via `brew install ffmpeg`. On most Ubuntu variants, `sudo apt-get install ffmpeg` should do it. On Ubuntu 14.04, however, you'll need to install avconv with `sudo apt-get install libav-tools`.""")
self.start()
示例4: _error
# 需要導入模塊: from gym import error [as 別名]
# 或者: from gym.error import DependencyNotInstalled [as 別名]
def _error(self):
"""docstring for _print_error"""
msg = 'Importing MujocoEnv failed. Please run: \n' + \
'\n`pip install mujoco-py` \n\n' + \
'and visit: ' + \
'https://github.com/openai/mujoco-py/'
raise DependencyNotInstalled(msg)