Я пытаюсь вызвать свой код Python из R. Это простой код, который я пробовал.
import tensorflow as tf
a1=tf.constant(23)
b1=tf.constant(25)
s1=tf.Session()
with tf.Session() as s1:
out=s1.run(a1+b1)
print (out)
Используя rPython (R-library), я пытался вызвать эту функцию.
library(rPython)
# Load/run the main Python script
python.load("/Desktop/add.py")
Но для этого произошла ошибка.
Error in python.exec(code, get.exception) :
Traceback (most recent call last):
File "/home/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/home/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/home/.local/lib/python2.7/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/install_sources#common_installation_problems
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.
In addition: Warning message:
In readLines(file) :
incomplete final line found on '/Desktop/add.py'
Но я установил тензор потока в R как install_tensorflow () .Я не мог найти проблему.Кто-нибудь знает, как это решить?