0
点赞
收藏
分享

微信扫一扫

【一】gym环境安装以及安装遇到的错误解决

1.gym模块的安装


运行命令窗口,输入cmd

【一】gym环境安装以及安装遇到的错误解决_深度学习

在命令行中输入:

​pip install gym -i https://pypi.douban.com/simple ​

镜像源地址可参考:​​tensorflow安装、常用python镜像源、tensorflow 深度学习强化学习教学​​ 

​pip install “ 你需要安装的包” -i https://pypi.douban.com/simple ​

即可安装成功



当然当你系统中存在自己创建环境,可以打开anaconda,输入下面指令即可

conda create -n tf #tf环境名称自定义 conda activate tf #激活环境 pip install gym -i https://pypi.tuna.tsinghua.edu.cn/simple



2. 遇到的错误

2.1 cannot uninstall a distutils installed project

pip install --ignore-installed xxx
pip install --ignore-installed tornado

输入即可。

2.2  AttributeError: module 'gym.envs.box2d' has no attribute 'xxxx'

import gym env = gym.make(id='xxx')

每当执行到这条语句的时候就报错,看来是没有安装box2d


pip install box2d-py

之后还出现错误如下:

error: command 'swig.exe' failed: No such file or directory

说明没有安装siwg

pip install siwg Collecting swig ERROR: Could not find a version that satisfies the requirement swig (from versions: none) ERROR: No matching distribution found for swig

则用anaconda安装

conda install swig

则可以使用box2d上面的envs了

注意pip时候最好+镜像源





举报

相关推荐

0 条评论