我想运行pysc2的代理,但是没有安装我的StarCraftⅡ
C:/ Program Files(x86)/StarCraftⅡ(pysc2使用的默认SC2PATH,我的操作系统是Windows10)。

如何更改pysc2的SC2PATH?

官方指南(https://github.com/deepmind/pysc2#run-an-agent)告诉我使用--helpfull,但我不知道哪个会有所帮助。以下是我得到的。

H:\Python>python -m pysc2.bin.agent --helpfull
Run an agent.
flags:

H:\Python\lib\site-packages\pysc2\bin\agent.py:
  --agent: Which agent to run
    (default: 'pysc2.agents.random_agent.RandomAgent')
  --agent_race: <R|P|T|Z>: Agent's race.
  --bot_race: <R|P|T|Z>: Bot's race.
  --difficulty: <1|2|3|4|5|6|7|8|9|A>: Bot's strength.
  --game_steps_per_episode: Game steps per episode.
    (default: '0')
    (an integer)
  --map: Name of a map to use.
  --max_agent_steps: Total agent steps.
    (default: '2500')
    (an integer)
  --minimap_resolution: Resolution for minimap feature layers.
    (default: '64')
    (an integer)
  --parallel: How many instances to run in parallel.
    (default: '1')
    (an integer)
  --[no]profile: Whether to turn on code profiling.
    (default: 'false')
  --[no]render: Whether to render with pygame.
    (default: 'true')
  --[no]save_replay: Whether to save a replay at the end.
    (default: 'true')
  --screen_resolution: Resolution for screen feature layers.
    (default: '84')
    (an integer)
  --step_mul: Game steps per agent step.
    (default: '8')
    (an integer)
  --[no]trace: Whether to trace the code execution.
    (default: 'false')

absl.app:
  -?,--[no]help: show this help
    (default: 'false')
  --[no]helpfull: show full help
    (default: 'false')
  --[no]helpshort: show this help
    (default: 'false')
  --[no]helpxml: like --helpfull, but generates XML output
    (default: 'false')
  --[no]only_check_args: Set to true to validate args and exit.
    (default: 'false')
  --[no]pdb_post_mortem: Set to true to handle uncaught exceptions with PDB post
    mortem.
    (default: 'false')
  --profile_file: Dump profile information to a file (for python -m pstats).
    Implies --run_with_profiling.
  --[no]run_with_pdb: Set to true for PDB debug mode
    (default: 'false')
  --[no]run_with_profiling: Set to true for profiling the script. Execution will
    be slower, and the output format might change over time.
    (default: 'false')
  --[no]use_cprofile_for_profiling: Use cProfile instead of the profile module
    for profiling. This has no effect unless --run_with_profiling is set.
    (default: 'true')

absl.logging:
  --[no]alsologtostderr: also log to stderr?
    (default: 'false')
  --log_dir: directory to write logfiles into
    (default: '')
  --[no]logtostderr: Should only log to stderr?
    (default: 'false')
  --[no]showprefixforinfo: If False, do not prepend prefix to info messages when
    it's logged to stderr, --verbosity is set to INFO level, and python logging
    is used.
    (default: 'true')
  --stderrthreshold: log messages at this level, or more severe, to stderr in
    addition to the logfile.  Possible values are 'debug', 'info', 'warning',
    'error', and 'fatal'.  Obsoletes --alsologtostderr. Using --alsologtostderr
    cancels the effect of this flag. Please also note that this flag is subject
    to --verbosity and requires logfile not be stderr.
    (default: 'fatal')
  -v,--verbosity: Logging verbosity level. Messages logged at this level or
    lower will be included. Set to 1 for debug logging. If the flag was not set
    or supplied, the value will be changed from the default of -1 (warning) to 0
    (info) after flags are parsed.
    (default: '-1')
    (an integer)

pysc2.lib.protocol:
  --sc2_verbose_protocol: Print the communication packets with SC2. 0 disables.
    -1 means all. >0 will print that many lines per packet. 20 is a good
    starting value.
    (default: '0')
    (an integer)

pysc2.lib.sc_process:
  --[no]sc2_verbose: Enable SC2 verbose logging.
    (default: 'false')

pysc2.run_configs:
  --sc2_run_config: Which run_config to use to spawn the binary.

pysc2.run_configs.platforms:
  --sc2_version: <3.16.1|3.17.0|3.17.1|3.17.2|3.18.0|3.19.0>: Which version of
    the game to use.

absl.flags:
  --flagfile: Insert flag definitions from the given file into the command line.
    (default: '')
  --undefok: comma-separated list of flag names that it is okay to specify on
    the command line even if the program does not define a flag with that name.
    IMPORTANT: flags in this list that have arguments MUST use the --flag=value
    format.
    (default: '')

最佳答案

我已经解决了这个问题,如果遇到相同的情况,我将告诉您如何解决。

找到安装python的折叠。在~/Lib/site-packages/中,有一个折叠pysc2,它是支持该程序的程序包。

~/pysc2/run_configs/platforms.py中,将C:/ Program Files(x86)/StarCraftⅡ更改为sc2位置。

切记通过注释记录所做的更改,以防出现一些错误。

关于python - 如何设置pysc2的SC2PATH,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/48255914/

10-11 07:48