以下內(nèi)容均在ubuntu18.0.4環(huán)境使用
最近在看《動(dòng)手學(xué)強(qiáng)化學(xué)習(xí)》安裝運(yùn)行相關(guān)的gym環(huán)境時(shí)候遇到了一些問題。
1、文中使用gym為== 0.18.3 該版本 支持 python3.8, python3.9 使用會(huì)有問題,env.seed()無法直接使用。(使用3.8.16 可成功運(yùn)行文中代碼)
2、在linux下本來已經(jīng)安裝了一個(gè)python3.9的環(huán)境,現(xiàn)在需要安裝pip3.8。(實(shí)現(xiàn)python 3.8 pip3.8和python3.9 pip3.9 共存)
(1)安裝python3.8
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.8
注意:安裝python3.8之后 可以使用python3.8 -m pip install XXXX安裝包了,但是 發(fā)現(xiàn)在安裝pandas,numpy 的時(shí)候會(huì)出現(xiàn)莫名其妙的問題,所以依然安裝pip3.8
(2)安裝pip3.8
wget -O /tmp/get-pip.py https://bootstrap.pypa.io/get-pip.py
python3.8 /tmp/get-pip.py
可是使用下面命令查看pip3.8是否成功了:
pip3.8 --version
(3)安裝gym==0.18.3
此時(shí)使用pip3.8 install gym==0.18.3安裝gym 會(huì)出現(xiàn)如下報(bào)錯(cuò):文章來源:http://www.zghlxwxcb.cn/news/detail-511302.html
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [1 lines of output]
error in gym setup command: 'extras_require' must be a dictionary whose values are strings or lists of strings containing valid project/version requirement specifiers.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed
× Encountered error while generating package metadata.
╰─> See above for output.
note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
報(bào)錯(cuò)原因:setuptools 版本太高了,無法安裝gym == 0.18.3 。根據(jù)chatGPT的建議,使用63.2.0的版本可以解決。
pip install setuptools == 63.2.0
再運(yùn)行:
pip3.8 install gym==0.18.3
順利解決文章來源地址http://www.zghlxwxcb.cn/news/detail-511302.html
到了這里,關(guān)于【動(dòng)手學(xué)強(qiáng)化學(xué)習(xí)】安裝gym subprocess-exited-with-error的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!