python停止运行tensorflow_在Python中无法加载本机TensorFlow运行时

运行该代码后,我有这个错误.

import gym

import random

import numpy as np

import tflearn

from tflearn.layers.core import input_data, dropout, fully_connected

from tflearn.layers.estimator import regression

from statistics import mean, median

from collections import Counter

LR = 1e-3

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

env.reset()

goal_steps = 500

score_requirement = 50

initial_games = 10000

def some_random_games_first():

for episode in range(5):

env.reset()

for t in range(goal_steps):

env.render()

action = env.action_space.sample()

observation, reward, done, info = env.step(action)

if done:

break

some_random_games_first()

这是错误.我该怎么做才能让它发挥作用.

Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 61, in

from tensorflow.python import pywrap_tensorflow

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in

_pywrap_tensorflow = swig_import_helper()

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper

_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 242, in load_module

return load_dynamic(name, filename, file)

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 342, in load_dynamic

return _load(spec)

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: @rpath/libcudart.8.0.dylib

Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so

Reason: image not found

During handling of the above exception, another exception occurred:

Traceback (most recent call last):

File "/Users/ziyaarslan/PycharmProjects/mlearning/test1.py", line 4, in

import tflearn

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tflearn/__init__.py", line 4, in

from . import config

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tflearn/config.py", line 3, in

import tensorflow as tf

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/__init__.py", line 24, in

from tensorflow.python import *

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 72, in

raise ImportError(msg)

ImportError: Traceback (most recent call last):

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 61, in

from tensorflow.python import pywrap_tensorflow

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 28, in

_pywrap_tensorflow = swig_import_helper()

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 24, in swig_import_helper

_mod = imp.load_module('_pywrap_tensorflow', fp, pathname, description)

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 242, in load_module

return load_dynamic(name, filename, file)

File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/imp.py", line 342, in load_dynamic

return _load(spec)

ImportError: dlopen(/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so, 10): Library not loaded: @rpath/libcudart.8.0.dylib

Referenced from: /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so

Reason: image not found

Failed to load the native TensorFlow runtime.

See https://github.com/tensorflow/tensorflow/blob/master/tensorflow/g3doc/get_started/os_setup.md#import_error

for some common reasons and solutions. Include the entire stack trace

above this error message when asking for help.

它给我一个链接,但它不起作用.

我还可以在哪里学习机器学习?

感谢所有试图提供帮助的人)))

@ rpath的/ libcudart.8.0.dylib

我想这也许是你的问题.你还没有这个库.如果你想学习ML,也许切换回tensorflow CPU是一个更好的选择.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值