{"id":111770,"date":"2026-10-01T19:57:00","date_gmt":"2026-10-01T11:57:00","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/111770.html"},"modified":"2026-10-01T19:57:00","modified_gmt":"2026-10-01T11:57:00","slug":"gymnasium%e5%88%9d%e6%ad%a5%e6%95%99%e7%a8%8b","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/111770.html","title":{"rendered":"gymnasium\u521d\u6b65\u6559\u7a0b"},"content":{"rendered":"<\/p>\n<h4>\u6587\u7ae0\u76ee\u5f55<\/h4>\n<ul>\n<li>\n<ul>\n<li>\u7b80\u4ecb<\/li>\n<li>\u4ee3\u7801\u89e3\u6790<\/li>\n<li>\u73af\u5883<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h3>\u7b80\u4ecb<\/h3>\n<p>gymnasium\u662fOpenAI\u7684\u5f3a\u5316\u5b66\u4e60(Reinforcement Learning, RL)\u5e93&#xff0c;\u63d0\u4f9b\u4e86\u4e00\u5957\u7edf\u4e00\u7684Python\u63a5\u53e3&#xff0c;\u7528\u4e8e\u5b9a\u4e49\u548c\u4ea4\u4e92\u5355\u667a\u80fd\u4f53\u5f3a\u5316\u5b66\u4e60\u73af\u5883&#xff0c;\u5e76\u5185\u7f6e\u4e86\u5927\u91cf\u7ecf\u5178\u53c2\u8003\u73af\u5883\u3002pip\u5b89\u88c5\u5373\u53ef<\/p>\n<p>pip install gymnasium -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple<\/p>\n<p>\u5b89\u88c5\u6210\u529f\u540e&#xff0c;\u7b80\u5355\u793a\u4f8b\u5982\u4e0b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001115659-6abe4a8b619a1.gif\" alt=\"\u5728\u8fd9\u91cc\u63d2\u5165\u56fe\u7247\u63cf\u8ff0\" \/><\/p>\n<p>\u8fd9\u662f\u4e2a\u5c0f\u8f66\u63a8\u6746(CartPole)\u73af\u5883&#xff0c;\u662fRL\u9886\u57df\u7684Hello World\u4efb\u52a1&#xff0c;\u5982\u56fe\u53ef\u89c1&#xff0c;\u4e00\u4e2a\u5c0f\u8f66(Cart)\u53ef\u4ee5\u5728\u4e00\u7ef4\u8f68\u9053\u4e0a\u5de6\u53f3\u79fb\u52a8&#xff0c;\u5c0f\u8f66\u4e0a\u94f0\u63a5\u7740\u4e00\u6839\u6746\u5b50(Pole)&#xff0c;\u667a\u80fd\u4f53(Agent)\u9700\u8981\u63a7\u5236\u5c0f\u8f66\u5728\u8f68\u9053\u8fb9\u754c\u5185\u5411\u5de6\u53f3\u79fb\u52a8&#xff0c;\u8981\u6c42\u6746\u5b50\u5c3d\u53ef\u80fd\u957f\u65f6\u95f4\u5730\u4fdd\u6301\u76f4\u7acb\u3002<\/p>\n<p>\u4ee3\u7801\u5982\u4e0b<\/p>\n<p><span class=\"token keyword\">import<\/span> gymnasium <span class=\"token keyword\">as<\/span> gym<\/p>\n<p>env <span class=\"token operator\">&#061;<\/span> gym<span class=\"token punctuation\">.<\/span>make<span class=\"token punctuation\">(<\/span><span class=\"token string\">&#034;CartPole-v1&#034;<\/span><span class=\"token punctuation\">,<\/span> render_mode<span class=\"token operator\">&#061;<\/span><span class=\"token string\">&#034;human&#034;<\/span><span class=\"token punctuation\">)<\/span><br \/>\nobs<span class=\"token punctuation\">,<\/span> info <span class=\"token operator\">&#061;<\/span> env<span class=\"token punctuation\">.<\/span>reset<span class=\"token punctuation\">(<\/span>seed<span class=\"token operator\">&#061;<\/span><span class=\"token number\">42<\/span><span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># \u91cd\u7f6e\u73af\u5883\u83b7\u53d6\u521d\u59cb\u89c2\u6d4b<\/span><\/p>\n<p><span class=\"token keyword\">print<\/span><span class=\"token punctuation\">(<\/span>obs<span class=\"token punctuation\">)<\/span>  <span class=\"token comment\"># [ 0.0273956  -0.00611216  0.03585979  0.0197368 ]<\/span><\/p>\n<p><span class=\"token keyword\">for<\/span> _ <span class=\"token keyword\">in<\/span> <span class=\"token builtin\">range<\/span><span class=\"token punctuation\">(<\/span><span class=\"token number\">1000<\/span><span class=\"token punctuation\">)<\/span><span class=\"token punctuation\">:<\/span><br \/>\n    action <span class=\"token operator\">&#061;<\/span> env<span class=\"token punctuation\">.<\/span>action_space<span class=\"token punctuation\">.<\/span>sample<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span>    <span class=\"token comment\"># \u7b56\u7565\u9009\u62e9\u52a8\u4f5c (\u6b64\u5904\u4e3a\u968f\u673a\u91c7\u6837)<\/span><br \/>\n    obs<span class=\"token punctuation\">,<\/span> reward<span class=\"token punctuation\">,<\/span> terminated<span class=\"token punctuation\">,<\/span> truncated<span class=\"token punctuation\">,<\/span> info <span class=\"token operator\">&#061;<\/span> env<span class=\"token punctuation\">.<\/span>step<span class=\"token punctuation\">(<\/span>action<span class=\"token punctuation\">)<\/span> <span class=\"token comment\"># \u6267\u884c\u72b6\u6001\u8f6c\u79fb<\/span><br \/>\n    <span class=\"token comment\"># \u68c0\u67e5\u56de\u5408\u7ed3\u675f\u6761\u4ef6<\/span><br \/>\n    <span class=\"token keyword\">if<\/span> terminated <span class=\"token keyword\">or<\/span> truncated<span class=\"token punctuation\">:<\/span><br \/>\n        obs<span class=\"token punctuation\">,<\/span> info <span class=\"token operator\">&#061;<\/span> env<span class=\"token punctuation\">.<\/span>reset<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span><\/p>\n<p>env<span class=\"token punctuation\">.<\/span>close<span class=\"token punctuation\">(<\/span><span class=\"token punctuation\">)<\/span> <span class=\"token comment\"># \u91ca\u653e\u8d44\u6e90<\/span><\/p>\n<h3>\u4ee3\u7801\u89e3\u6790<\/h3>\n<p>gym.make\u7528\u4e8e\u521b\u5efa\u73af\u5883&#xff0c;CartPole-v1\u662f\u4e2a\u5c0f\u8f66\u63a8\u6746\u73af\u5883\u7684ID&#xff0c;\u91cc\u9762\u9884\u7f6e\u4e86\u4e0a\u56fe\u4e2d\u7684\u5012\u7acb\u6446\u7ed3\u6784\u3002render_mode\u4e3a\u6e32\u67d3\u6a21\u5f0f&#xff0c;human\u8868\u793a\u5728\u5c4f\u5e55\u4e0a\u5f39\u51fa\u4e00\u4e2a\u56fe\u5f62\u7a97\u53e3&#xff0c;\u4ee5\u4eba\u7c7b\u53ef\u7406\u89e3\u7684\u5e27\u7387\u5b9e\u65f6\u64ad\u653e\u73af\u5883\u7684\u753b\u9762\u3002<\/p>\n<p>reset\u7528\u4e8e\u91cd\u7f6e\u73af\u5883&#xff0c;\u5176\u8f93\u5165\u4e3a\u968f\u673a\u6570\u79cd\u5b50&#xff0c;\u8fd4\u56de\u503c\u4e3a\u72b6\u6001\u7a7a\u95f4\u548c\u4fe1\u606f\u3002CartPole-v1\u73af\u5883\u4e2d&#xff0c;\u72b6\u6001\u7a7a\u95f4\u5305\u62ec\u56db\u4e2a\u503c&#xff0c;\u5206\u522b\u662f\u5c0f\u8f66\u4f4d\u7f6e\u3001\u5c0f\u8f66\u901f\u5ea6\u3001\u6746\u5b50\u89d2\u5ea6\u3001\u6746\u5b50\u89d2\u901f\u5ea6\u3002<\/p>\n<p>action_space\u662fenv\u7684\u52a8\u4f5c\u7a7a\u95f4&#xff0c;\u5728\u672c\u4f8b\u4e2d&#xff0c;\u53ea\u5305\u542b<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        {<\/p>\n<p>        0<\/p>\n<p>        ,<\/p>\n<p>        1<\/p>\n<p>        }<\/p>\n<p>       \\\\{0,1\\\\}<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mopen\">{<\/span><span class=\"mord\">0<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord\">1<\/span><span class=\"mclose\">}<\/span><\/span><\/span><\/span><\/span>&#xff0c;\u8868\u793a\u5411\u5de6\u548c\u5411\u53f3\u63a8\u8f66\u3002sample\u4e3a\u968f\u673a\u91c7\u6837\u3002\u5728\u8fed\u4ee3\u8fc7\u7a0b\u4e2d&#xff0c;\u8fd9\u4ee3\u8868\u83b7\u53d6\u4e00\u6b21\u5408\u6cd5\u52a8\u4f5c\u3002<\/p>\n<p>step(action)\u8868\u793a\u6267\u884c\u5f53\u524d\u52a8\u4f5c\u3002\u5176\u8fd4\u56de\u503c\u5305\u62ec<\/p>\n<ul>\n<li>obs \u4e0b\u4e00\u65f6\u523b\u7684\u89c2\u6d4b\u503c<\/li>\n<li>reward \u5373\u65f6\u5956\u52b1<\/li>\n<li>terminated \u81ea\u7136\u7ec8\u6b62\u6807\u5fd7&#xff0c;\u8868\u793a\u4efb\u52a1\u5f7b\u5e95\u5931\u8d25\u6216\u6210\u529f&#xff0c;\u5728\u672c\u4f8b\u4e2d&#xff0c;\u5982\u679cPole\u5012\u4e86\u6216\u8005\u5c0f\u8f66\u51b2\u51fa\u8f68\u9053&#xff0c;\u5219\u7ec8\u6b62\u8fd0\u884c<\/li>\n<li>truncated \u4eba\u4e3a\u622a\u65ad\u6807\u5fd7&#xff0c;\u8868\u793a\u56e0\u4e3a\u73af\u5883\u5916\u90e8\u7684\u975e\u7269\u7406\u9650\u5236\u5bfc\u81f4\u7684\u4e91\u8054\u9636\u6570\u3002<\/li>\n<li>info \u4e00\u4e9b\u5176\u4ed6\u4fe1\u606f<\/li>\n<\/ul>\n<h3>\u73af\u5883<\/h3>\n<p>\u3010Env\u3011\u662fGymnasium\u7684\u6838\u5fc3\u7c7b&#xff0c;\u5b9e\u73b0\u4e86\u9a6c\u5c14\u53ef\u592b\u51b3\u7b56\u8fc7\u7a0b (markovian decision process, MDP) \u7684\u79bb\u6563\u65f6\u95f4\u5f62\u5f0f\u5316&#xff0c;\u4e00\u4e2aMDP\u901a\u5e38\u7531\u4e94\u5143\u7ec4<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        (<\/p>\n<p>        S<\/p>\n<p>        ,<\/p>\n<p>        A<\/p>\n<p>        ,<\/p>\n<p>        P<\/p>\n<p>        ,<\/p>\n<p>        R<\/p>\n<p>        ,<\/p>\n<p>        \u03b3<\/p>\n<p>        )<\/p>\n<p>       (S, A, P, R, \\\\gamma)<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0576em\">S<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord mathnormal\">A<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1389em\">P<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0077em\">R<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0556em\">\u03b3<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\u5b9a\u4e49&#xff0c;\u53c2\u6570\u4e0eEnv\u4e2d\u7684\u6210\u5458\u4e00\u4e00\u5bf9\u5e94<\/p>\n<table>\n<tr>\u53c2\u6570\u8bf4\u660e\u6210\u5458\u6216\u65b9\u6cd5<\/tr>\n<tbody>\n<tr>\n<td><span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>           S<\/p>\n<p>          S<\/p>\n<p>       <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0576em\">S<\/span><\/span><\/span><\/span><\/span><\/td>\n<td>\u72b6\u6001\u7a7a\u95f4(State Space)<\/td>\n<td>observation_space<\/td>\n<\/tr>\n<tr>\n<td><span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>           A<\/p>\n<p>          A<\/p>\n<p>       <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.6833em\"><\/span><span class=\"mord mathnormal\">A<\/span><\/span><\/span><\/span><\/span><\/td>\n<td>\u52a8\u4f5c\u7a7a\u95f4(Action Space)<\/td>\n<td>action_space<\/td>\n<\/tr>\n<tr>\n<td><span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>           (<\/p>\n<p>           P<\/p>\n<p>           ,<\/p>\n<p>           R<\/p>\n<p>           )<\/p>\n<p>          (P,R)<\/p>\n<p>       <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mopen\">(<\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1389em\">P<\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0077em\">R<\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span><\/td>\n<td>\u72b6\u6001\u8f6c\u79fb\u548c\u5956\u52b1<\/td>\n<td>step(action)<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5176\u4e2d&#xff0c;step\u6267\u884c\u52a8\u4f5c<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>         a<\/p>\n<p>         t<\/p>\n<p>       a_t<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 0.5806em;vertical-align: -0.15em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\">a<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.2806em\"><span class=\"\" style=\"top: -2.55em;margin-left: 0em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t<\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.15em\"><span class=\"\"><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span><\/span>\u540e&#xff0c;\u73af\u5883\u6839\u636e\u8f6c\u79fb\u6982\u7387<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        P<\/p>\n<p>        (<\/p>\n<p>         s<\/p>\n<p>          t<\/p>\n<p>          &#043;<\/p>\n<p>          1<\/p>\n<p>        \u2223<\/p>\n<p>         s<\/p>\n<p>         t<\/p>\n<p>        ,<\/p>\n<p>         a<\/p>\n<p>         t<\/p>\n<p>        )<\/p>\n<p>       P(s_{t&#043;1}\\\\vert s_t, a_t)<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.1389em\">P<\/span><span class=\"mopen\">(<\/span><span class=\"mord\"><span class=\"mord mathnormal\">s<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.3011em\"><span class=\"\" style=\"top: -2.55em;margin-left: 0em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mtight\"><span class=\"mord mathnormal mtight\">t<\/span><span class=\"mbin mtight\">&#043;<\/span><span class=\"mord mtight\">1<\/span><\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.2083em\"><span class=\"\"><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mord\">\u2223<\/span><span class=\"mord\"><span class=\"mord mathnormal\">s<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.2806em\"><span class=\"\" style=\"top: -2.55em;margin-left: 0em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t<\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.15em\"><span class=\"\"><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\">a<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.2806em\"><span class=\"\" style=\"top: -2.55em;margin-left: 0em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t<\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.15em\"><span class=\"\"><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\u91c7\u6837\u51fa\u4e0b\u4e00\u72b6\u6001&#xff0c;\u5e76\u8ba1\u7b97\u5956\u52b1<span class=\"katex--inline\"><span class=\"katex\"><span class=\"katex-mathml\"><\/p>\n<p>        R<\/p>\n<p>        (<\/p>\n<p>         s<\/p>\n<p>         t<\/p>\n<p>        ,<\/p>\n<p>         a<\/p>\n<p>         t<\/p>\n<p>        )<\/p>\n<p>       R(s_t, a_t)<\/p>\n<p>    <\/span><span class=\"katex-html\"><span class=\"base\"><span class=\"strut\" style=\"height: 1em;vertical-align: -0.25em\"><\/span><span class=\"mord mathnormal\" style=\"margin-right: 0.0077em\">R<\/span><span class=\"mopen\">(<\/span><span class=\"mord\"><span class=\"mord mathnormal\">s<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.2806em\"><span class=\"\" style=\"top: -2.55em;margin-left: 0em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t<\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.15em\"><span class=\"\"><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mpunct\">,<\/span><span class=\"mspace\" style=\"margin-right: 0.1667em\"><\/span><span class=\"mord\"><span class=\"mord mathnormal\">a<\/span><span class=\"msupsub\"><span class=\"vlist-t vlist-t2\"><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.2806em\"><span class=\"\" style=\"top: -2.55em;margin-left: 0em;margin-right: 0.05em\"><span class=\"pstrut\" style=\"height: 2.7em\"><\/span><span class=\"sizing reset-size6 size3 mtight\"><span class=\"mord mathnormal mtight\">t<\/span><\/span><\/span><\/span><span class=\"vlist-s\">\u200b<\/span><\/span><span class=\"vlist-r\"><span class=\"vlist\" style=\"height: 0.15em\"><span class=\"\"><\/span><\/span><\/span><\/span><\/span><\/span><span class=\"mclose\">)<\/span><\/span><\/span><\/span><\/span>\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u76ee\u5f55\u7b80\u4ecb\u4ee3\u7801\u89e3\u6790\u73af\u5883\u7b80\u4ecb<br \/>\ngymnasium\u662fOpenAI\u7684\u5f3a\u5316\u5b66\u4e60(Reinforcement Learning, RL)\u5e93&#xff0c;\u63d0\u4f9b\u4e86\u4e00\u5957\u7edf\u4e00\u7684Python\u63a5\u53e3&#xff0c;\u7528\u4e8e\u5b9a\u4e49\u548c\u4ea4\u4e92\u5355\u667a\u80fd\u4f53\u5f3a\u5316\u5b66\u4e60\u73af\u5883&#xff0c;\u5e76\u5185\u7f6e\u4e86\u5927\u91cf\u7ecf\u5178\u53c2\u8003\u73af\u5883\u3002pip\u5b89\u88c5\u5373\u53ef<br \/>\npip install gymnasium -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple\u5b89\u88c5\u6210\u529f\u540e&#xff0c;\u7b80\u5355\u793a\u4f8b\u5982\u4e0b \u8fd9\u662f\u4e2a\u5c0f\u8f66\u63a8\u6746(Ca<\/p>\n","protected":false},"author":2,"featured_media":111769,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[12717,12716,9657,12718,752],"topic":[],"class_list":["post-111770","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-gym","tag-gymnasium","tag-9657","tag-12718","tag-752"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>gymnasium\u521d\u6b65\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.wsisp.com\/helps\/111770.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"gymnasium\u521d\u6b65\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u6587\u7ae0\u76ee\u5f55\u7b80\u4ecb\u4ee3\u7801\u89e3\u6790\u73af\u5883\u7b80\u4ecb gymnasium\u662fOpenAI\u7684\u5f3a\u5316\u5b66\u4e60(Reinforcement Learning, RL)\u5e93&#xff0c;\u63d0\u4f9b\u4e86\u4e00\u5957\u7edf\u4e00\u7684Python\u63a5\u53e3&#xff0c;\u7528\u4e8e\u5b9a\u4e49\u548c\u4ea4\u4e92\u5355\u667a\u80fd\u4f53\u5f3a\u5316\u5b66\u4e60\u73af\u5883&#xff0c;\u5e76\u5185\u7f6e\u4e86\u5927\u91cf\u7ecf\u5178\u53c2\u8003\u73af\u5883\u3002pip\u5b89\u88c5\u5373\u53ef pip install gymnasium -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple\u5b89\u88c5\u6210\u529f\u540e&#xff0c;\u7b80\u5355\u793a\u4f8b\u5982\u4e0b \u8fd9\u662f\u4e2a\u5c0f\u8f66\u63a8\u6746(Ca\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/111770.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-10-01T11:57:00+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001115659-6abe4a8b619a1.gif\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/111770.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/111770.html\",\"name\":\"gymnasium\u521d\u6b65\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-10-01T11:57:00+00:00\",\"dateModified\":\"2026-10-01T11:57:00+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/111770.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/111770.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/111770.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"gymnasium\u521d\u6b65\u6559\u7a0b\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"gymnasium\u521d\u6b65\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.wsisp.com\/helps\/111770.html","og_locale":"zh_CN","og_type":"article","og_title":"gymnasium\u521d\u6b65\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u6587\u7ae0\u76ee\u5f55\u7b80\u4ecb\u4ee3\u7801\u89e3\u6790\u73af\u5883\u7b80\u4ecb gymnasium\u662fOpenAI\u7684\u5f3a\u5316\u5b66\u4e60(Reinforcement Learning, RL)\u5e93&#xff0c;\u63d0\u4f9b\u4e86\u4e00\u5957\u7edf\u4e00\u7684Python\u63a5\u53e3&#xff0c;\u7528\u4e8e\u5b9a\u4e49\u548c\u4ea4\u4e92\u5355\u667a\u80fd\u4f53\u5f3a\u5316\u5b66\u4e60\u73af\u5883&#xff0c;\u5e76\u5185\u7f6e\u4e86\u5927\u91cf\u7ecf\u5178\u53c2\u8003\u73af\u5883\u3002pip\u5b89\u88c5\u5373\u53ef pip install gymnasium -i https:\/\/pypi.tuna.tsinghua.edu.cn\/simple\u5b89\u88c5\u6210\u529f\u540e&#xff0c;\u7b80\u5355\u793a\u4f8b\u5982\u4e0b \u8fd9\u662f\u4e2a\u5c0f\u8f66\u63a8\u6746(Ca","og_url":"https:\/\/www.wsisp.com\/helps\/111770.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-10-01T11:57:00+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/10\/20261001115659-6abe4a8b619a1.gif"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/111770.html","url":"https:\/\/www.wsisp.com\/helps\/111770.html","name":"gymnasium\u521d\u6b65\u6559\u7a0b - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-10-01T11:57:00+00:00","dateModified":"2026-10-01T11:57:00+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/111770.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/111770.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/111770.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"gymnasium\u521d\u6b65\u6559\u7a0b"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/111770","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=111770"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/111770\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/111769"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=111770"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=111770"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=111770"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=111770"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}