【问题标题】:Theano Path in Python Directory - RuntimeErrorPython 目录中的 Theano 路径 - RuntimeError
【发布时间】:2017-10-26 15:12:17
【问题描述】:

我正在配置 python、theano、keras、tensorFlow。我几乎让它工作了,但在使用 pygpu0.6.9 时收到版本错误。所以我更新了theano版本(根据一些说明)。之后,我再次运行了测试文件。我不再收到 pygpu 错误,而是收到此错误:

“你的 Python 路径中有 theano 目录。这 [原文如此] 在 Python 3 中不起作用。”

这可能是一个简单的修复,但我对此比较陌生。感谢您的帮助。

PS

C:\program files\anaconda3> python test.py
Traceback (most recent call last):
  File "test.py", line 1, in <module>
    from theano import function, config, shared, tensor
  File "C:\Program Files\Anaconda3\lib\site-packages\theano\__init__.py", line 79, in <module>
    "You have the theano directory in your Python path."
RuntimeError: You have the theano directory in your Python path. This do not work in Python 3.

【问题讨论】:

  • 您使用哪个版本的 Python 和 Theano?

标签: python tensorflow keras theano


【解决方案1】:

您在关注code 时出错

rpath = os.path.realpath(__path__[0])
for p in sys.path:
    if os.path.realpath(p) != rpath:
        continue
    if PY3:
        raise RuntimeError(
            "You have the theano directory in your Python path."
            " This do not work in Python 3.")
    else:
        warnings.warn(
            "You have the theano directory in your Python path."
            " This is will not work in Python 3.")
    break

我不知道为什么,但作者会检查 Theano 的路径是否在 sys.path 中(从环境变量 PYTHONPATH 初始化)。尝试从 PYTHONPATH 环境变量中删除 Theano 的路径。

【讨论】:

    猜你喜欢
    • 2018-04-18
    • 2016-08-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2023-04-05
    • 2011-03-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多