用python安装张量流后,我尝试用C语言安装。
我尝试:
TF_TYPE="cpu" # Change to "gpu" for GPU support
OS="linux" # Change to "darwin" for macOS
TARGET_DIRECTORY="/usr/local"
curl -L \
"https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-${TF_TYPE}-${OS}-x86_64-1.6.0.tar.gz" |
sudo tar -C $TARGET_DIRECTORY -xz
我使用C(桌面上的hello_tf.c)在sublime中构建测试,
#include <stdio.h>
#include <tensorflow/c/c_api.h>
int main() {
printf("Hello from TensorFlow C library version %s\n", TF_Version());
return 0;
}
run&#34; gcc hello_tf.c&#34;在终端,我收到错误
MacBook-Pro:~ juneleungchan$ gcc hello_tf.c
clang: error: no such file or directory: 'hello_tf.c'
clang: error: no input files
在sublime中运行,得到错误:
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
Undefined symbols for architecture x86_64:
"_TF_Version", referenced from:
_main in hello_tf-bffca9.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
[Finished in 0.1s with exit code 1]
[shell_cmd: g++ "/Users/juneleungchan/Desktop/hello_tf.c" -o "/Users/juneleungchan/Desktop/hello_tf"]
[dir: /Users/juneleungchan/Desktop]
[path: /Library/Frameworks/Python.framework/Versions/3.6/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/share/dotnet:/Library/Frameworks/Mono.framework/Versions/Current/Commands:/Applications/Xamarin Workbooks.app/Contents/SharedSupport/path-bin]
我在OSX 10.12.6上,如何用C安装?