小编Mik*_*oho的帖子

在OpenAI的env.render()之后出错

我想让下面的代码工作.

import gym

env = gym.make("CartPole-v0")

env.reset()

env.render()
Run Code Online (Sandbox Code Playgroud)

运行前3行没有问题,但是当我运行第4行时,我得到错误:

Traceback (most recent call last):

  File "<ipython-input-3-a692a1a1ffe7>", line 1, in <module>
    env.render()

  File "/home/mikedoho/gym/gym/core.py", line 150, in render
    return self._render(mode=mode, close=close)

  File "/home/mikedoho/gym/gym/core.py", line 286, in _render
    return self.env.render(mode, close)

  File "/home/mikedoho/gym/gym/core.py", line 150, in render
    return self._render(mode=mode, close=close)

  File "/home/mikedoho/gym/gym/envs/classic_control/cartpole.py", line 116, in _render
    self.viewer = rendering.Viewer(screen_width, screen_height)

  File "/home/mikedoho/gym/gym/envs/classic_control/rendering.py", line 51, in __init__
    self.window = pyglet.window.Window(width=width, height=height, display=display)

  File "/home/mikedoho/anaconda3/lib/python3.6/site-packages/pyglet/window/__init__.py", line 504, in __init__
    screen = display.get_default_screen()

  File "/home/mikedoho/anaconda3/lib/python3.6/site-packages/pyglet/canvas/base.py", …
Run Code Online (Sandbox Code Playgroud)

python-3.x openai-gym

8
推荐指数
1
解决办法
5004
查看次数

加载运行时 CuDNN 库:7.1.2,但源代码编译为:7.6.0;乌班图18.04

我试图解决标题中的问题:

Loaded runtime CuDNN library: 7.1.2 but source was compiled with: 7.6.0.  CuDNN library major and minor version needs to match or have higher minor version in case of CuDNN 7.0 or later version
Run Code Online (Sandbox Code Playgroud)

我读过其他几篇文章(例如:加载运行时 CuDNN 库:5005(兼容版本 5000),但源代码是用 5103(兼容版本 5100)编译的

这基本上告诉我,我的机器有 CuDNN 7.1.2,但我需要 7.6.0。答案是下载并安装 7.6.*

唯一的问题是我认为我是按照 nvidia archive ( https://developer.nvidia.com/rdp/cudnn-archive )上的说明进行操作的

如果我去读/usr/local/cuda/includecudnn.h会显示

#if !defined(CUDNN_H_)
#define CUDNN_H_

#define CUDNN_MAJOR 7
#define CUDNN_MINOR 6
#define CUDNN_PATCHLEVEL 4
Run Code Online (Sandbox Code Playgroud)

目前我安装了 CUDA-10.0、10.1 和 10.2,并将 .bashrc 设置为 10.0(尽管nvcc --version …

tensorflow ubuntu-18.04 tensorflow2.0

6
推荐指数
1
解决办法
5634
查看次数

模块“tensorflow”没有属性“constant”

我以前安装了 tensorflow 并安装了 gpu 支持并正常工作。我尝试安装 keras 之后什么都不起作用了。我已经卸载了 keras 和 tensorflow。

我尝试按照 tensorflow 网页https://www.tensorflow.org/install/install_linux(顺便说一下,我正在运行 ubuntu 18 )上的说明重新安装支持 gpu 的 tensorfow(现在是 1.9 版)。我尝试运行代码

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
Run Code Online (Sandbox Code Playgroud)

我得到了错误

import tensorflow as tf
hello = tf.constant('Hello, TensorFlow!')
sess = tf.Session()
print(sess.run(hello))
Traceback (most recent call last):

  File "<ipython-input-2-25b92e4d5dec>", line 2, in <module>
    hello = tf.constant('Hello, TensorFlow!')

AttributeError: module 'tensorflow' has no attribute 'constant'
Run Code Online (Sandbox Code Playgroud)

我尝试查看其他线程,有人建议将 C 大写为“常量”,但这也不起作用。

任何建议都会很棒!

谢谢

python tensorflow

2
推荐指数
2
解决办法
1万
查看次数