Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/334.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何设置pysc2的SC2路径_Python_Cmd_Path_Starcraftgym - Fatal编程技术网

Python 如何设置pysc2的SC2路径

Python 如何设置pysc2的SC2路径,python,cmd,path,starcraftgym,Python,Cmd,Path,Starcraftgym,我想运行pysc2的代理,但我的星际争霸Ⅱ没有安装在 C:/ProgramFiles(x86)/StarCraftⅡ(pysc2使用的默认SC2PATH,我的操作系统是Windows10) 如何更改pysc2的SC2路径 官方指南()告诉我使用--helpfull,但我不知道哪一个有用。以下是我得到的 H:\Python>python -m pysc2.bin.agent --helpfull Run an agent. flags: H:\Python\lib\site-package

我想运行pysc2的代理,但我的星际争霸Ⅱ没有安装在 C:/ProgramFiles(x86)/StarCraftⅡ(pysc2使用的默认
SC2PATH
,我的操作系统是Windows10)

如何更改pysc2的SC2路径

官方指南()告诉我使用
--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: '')
H:\Python>Python-m pysc2.bin.agent--helpfull
运行代理。
旗帜:
H:\Python\lib\site packages\pysc2\bin\agent.py:
--代理:要运行哪个代理
(默认值:“pysc2.agents.random\u agent.RandomAgent”)
--代理的种族:代理的种族。
--机器人的比赛。
--困难:机器人的力量。
--每集游戏步骤:每集游戏步骤。
(默认值:“0”)
(整数)
--映射:要使用的映射的名称。
--最大代理步数:总代理步数。
(默认值:“2500”)
(整数)
--小地图分辨率:小地图要素图层的分辨率。
(默认值:“64”)
(整数)
--并行:并行运行的实例数。
(默认值:“1”)
(整数)
--[否]配置文件:是否打开代码配置文件。
(默认值:“false”)
--[否]渲染:是否使用pygame渲染。
(默认值:“true”)
--[否]保存重播:是否在最后保存重播。
(默认值:“true”)
--屏幕分辨率:屏幕要素图层的分辨率。
(默认值:“84”)
(整数)
--步骤:每个代理步骤的游戏步骤。
(默认值:“8”)
(整数)
--[否]跟踪:是否跟踪代码执行。
(默认值:“false”)
absl.app:
-?,--[no]帮助:显示此帮助
(默认值:“false”)
--[否]帮助信息:显示完全帮助信息
(默认值:“false”)
--[否]helpshort:显示此帮助
(默认值:“false”)
--[no]helpxml:类似于--helpfull,但生成XML输出
(默认值:“false”)
--[否]仅检查参数:设置为true以验证参数并退出。
(默认值:“false”)
--[否]pdb_post_mortem:设置为true可处理pdb post的未捕获异常
死尸。
(默认值:“false”)
--profile_file:将配置文件信息转储到一个文件(对于python-mpstats)。
暗示——使用_评测运行_。
--[否]使用_pdb运行_:对于pdb调试模式,设置为true
(默认值:“false”)
--[否]使用_评测运行_:设置为true以评测脚本。执行遗嘱
如果速度较慢,则输出格式可能会随时间而更改。
(默认值:“false”)
--[否]使用配置文件\u进行配置:使用配置文件而不是配置文件模块
用于分析。除非设置了--run_with_profiling,否则此操作无效。
(默认值:“true”)
absl.logging:
--[no]alsologtostderr:是否也登录到stderr?
(默认值:“false”)
--log_dir:将日志文件写入的目录
(默认值:“”)
--[否]logtostderr:是否只应登录到stderr?
(默认值:“false”)
--[否]showprefixforinfo:如果为False,则在出现以下情况时,不要在信息消息前添加前缀:
它被记录到stderr,-verbosity被设置为INFO-level,而python日志记录被设置为INFO-level
使用。
(默认值:“true”)
--stderrthreshold:将此级别或更严重级别的消息记录到中的stderr
添加到日志文件中。可能的值为“调试”、“信息”、“警告”,
“错误”和“致命”。废弃品——也是废弃品。使用--alsologtostderr
取消此标志的效果。还请注意,此标志受
to--详细性,要求日志文件不是stderr。
(默认值:“致命”)
-v、 --详细程度:记录详细程度。在此级别记录的消息或
较低的将包括在内。调试日志记录设置为1。如果没有设置该标志
或提供,该值将从默认值-1(警告)更改为0
(信息)解析标志后。
(默认值:'-1')
(整数)
pysc2.lib.protocol:
--sc2\u详细协议:使用sc2打印通信数据包。0禁用。
-1表示全部。>0将为每个数据包打印那么多行。20是个好主意
起始值。
(默认值:“0”)
(整数)
pysc2.lib.sc_进程:
--[否]sc2\u详细:启用sc2详细日志记录。
(默认值:“false”)
pysc2.run\u配置:
--sc2_run_config:用于生成二进制文件的运行配置。
pysc2.run_配置S.platforms:
--sc2_版本::的哪个版本
要使用的游戏。
横旗:
--flagfile:将给定文件中的标志定义插入命令行。
(默认值:“”)
--undefok:可以指定的标志名称的逗号分隔列表
命令行,即使程序没有用该名称定义标志。
要点:此列表中具有参数的标志必须使用--flag=值
格式。
(默认值:“”)

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

找到安装python的地方。在
~/Lib/site包/
中,有一个名为
pysc2
的包,它是支持该程序的包

~/pysc2/run\u configs/platforms.py
中,将C:/Program Files(x86)/StarCraftⅡ更改为您的sc2位置


请记住记录您所做的更改,以防出现错误。

您是否有名为
SC2PATH
的环境变量?是的,我已经找到了。谢谢