python输出结果存到文件拒绝访问_python – Tensorflow Windows访问文件夹被拒绝:“NewRandomAccessFile无法创建/打开:访问被拒绝. ;输入/输出错误“...

我最近安装了Tensorflow for

Windows.我正在尝试一个基本教程,我需要访问包含图像子文件夹的文件夹.

我无法访问图像文件夹,因为“访问被拒绝”.这在Anaconda 4.2提示符和Pycharm中都会发生,并使用基本的Python 3.5发行版.

我已经为所涉及的所有内容授予了管理员权限,并且我今天重新安装了所有软件,因此它全部更新到最新版本.

任何想法或帮助将不胜感激!

# change this as you see fit

image_path = 'C:/moles'

# Read in the image_data

image_data = tf.gfile.FastGFile(image_path, 'rb').read()

# Loads label file, strips off carriage return

label_lines = [line.rstrip() for line

in tf.gfile.GFile("/tf_files/retrained_labels.txt")]

# Unpersists graph from file

with tf.gfile.FastGFile("/tf_files/retrained_graph.pb", 'rb') as f:

graph_def = tf.GraphDef()

graph_def.ParseFromString(f.read())

_ = tf.import_graph_def(graph_def, name='')

with tf.Session() as sess:

# Feed the image_data as input to the graph and get first prediction

softmax_tensor = sess.graph.get_tensor_by_name('final_result:0')

predictions = sess.run(softmax_tensor, \

{'DecodeJpeg/contents:0': image_data})

# Sort to show labels of first prediction in order of confidence

top_k = predictions[0].argsort()[-len(predictions[0]):][::-1]

for node_id in top_k:

human_string = label_lines[node_id]

score = predictions[0][node_id]

print('%s (score = %.5f)' % (human_string, score))

"C:\Program Files\Anaconda3\python.exe" C:/Users/Ryan/Desktop/tfupdate/tf.py

Traceback (most recent call last):

File "C:/Users/Ryan/Desktop/tfupdate/tf.py", line 7, in

image_data = tf.gfile.FastGFile(image_path, 'rb').read()

File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 106, in read

self._preread_check()

File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\lib\io\file_io.py", line 73, in _preread_check

compat.as_bytes(self.__name), 1024 * 512, status)

File "C:\Program Files\Anaconda3\lib\contextlib.py", line 66, in __exit__

next(self.gen)

File "C:\Program Files\Anaconda3\lib\site-packages\tensorflow\python\framework\errors_impl.py", line 469, in raise_exception_on_not_ok_status

pywrap_tensorflow.TF_GetCode(status))

tensorflow.python.framework.errors_impl.UnknownError: NewRandomAccessFile failed to Create/Open: C:/moles : Access is denied.

; Input/output error

Process finished with exit code 1

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值