首页 文章

在MacOS上使用最新的tensorflow源进行Tensorflow编译错误

提问于
浏览
0

我正在尝试在我的Mac OSx Yosemite(10.10.5)上构建tensorflow源 . 我运行此命令后

bazel build --config=opt //tensorflow/tools/pip_package:build_pip_package

我收到这个错误

C规则编译'//tensorflow/core:candidate_sampling_ops_op_lib'失败:cc_wrapper.sh失败: error 执行命令external / local_config_cc / cc_wrapper.sh -U_FORTIFY_SOURCE -fstack-protector -Wall -Wthread-safety -Wself-assign -fcolor-diagnostics -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG ...(跳过剩余的95个参数):com.google.devtools.build.lib.shell.BadExitStatusException:进程退出,状态为1. tensorflow / core / ops / candidate_sampling_ops.cc: 392:7: error :当lambda表达式未指定显式返回类型返回Status :: OK()时,返回类型'tensorflow::Status'必须匹配上一个返回类型'const ::tensorflow::Status' ^ tensorflow / core / ops / candidate_sampling_ops.cc:376:17:错误:没有可行的从'tensorflow::(lambda at tensorflow/core/ops/candidate_sampling_ops.cc:376:17)'转换为'tensorflow :: Status(*)(shape_inference :: InferenceContext)' . SetShapeFn([](InferenceContext c){

我可能做错了什么?

1 回答

  • 0

    tensorflow的最新版本不可编译/适用于mac os x .

    这是我的脚本,以获得在mac-osx sierra i7 no gpu上运行mac-osx sierra tensorflow 1.0的tensorflow . 我仍在努力获得SSE等正确编译和更高版本的张量流 - 但无论如何 . Tensorflow与macs不同 - 但DL4J是!

    更新:你不应该't need to update from Yosemite. I was able to get r1.3 to compile with SSE and AVX! So the '最新版本' at time of writing has known issues - r1.3 is the latest stable build. I' ve包括脚本在下面做一个正确的构建,但也包括http://www.josephmiguel.com/building-tensorflow-1-3-from-source-on-mac-osx-sierra-macbook-pro-i7-with-sse-and-avx/所有关于此事的细节 .

    one time install
    
    install anaconda3 pkg # manually download this and install the package
    conda update conda
    conda create -n dl python=3.6 anaconda
    source activate dl
    
    cd /
    brew install bazel
    pip install six numpy wheel
    pip install –upgrade https://storage.googleapis.com/tensorflow/mac/cpu/protobuf-3.1.0-cp35-none-macosx_10_11_x86_64.whl
    
    sudo -i
    cd /
    rm -rf tensorflow # if rerunning the script
    cd /
    git clone https://github.com/tensorflow/tensorflow
    
    
    Step 1
    
    cd /tensorflow
    git checkout r1.3 -f
    cd /
    chmod -R 777 tensorflow
    cd /tensorflow
    ./configure # accept all default settings
    
    
    Step 2
    
    // https://stackoverflow.com/questions/41293077/how-to-compile-tensorflow-with-sse4-2-and-avx-instructions
    bazel build –config=opt –copt=-mavx –copt=-mavx2 –copt=-mfma //tensorflow/tools/pip_package:build_pip_package
    
    
    Step 3
    
    bazel-bin/tensorflow/tools/pip_package/build_pip_package /tmp/tensorflow_pkg
    pip install /tmp/tensorflow_pkg/tensorflow-1.0.1-cp36-cp36m-macosx_10_7_x86_64.whl
    
    
    Step 4
    
    cd ~
    ipython
    
    
    Step 5
    
    import tensorflow as tf
    hello = tf.constant(‘Hello, TensorFlow!’)
    sess = tf.Session()
    print(sess.run(hello))
    
    
    Step 6
    
    pip uninstall /tmp/tensorflow_pkg/tensorflow-1.0.1-cp36-cp36m-macosx_10_7_x86_64.whl
    

相关问题