2016-08-22 26 views

回答

2

@ keveman的回答告訴我們默認執行但不是活動執行。

重要的是,PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION環境變量影響其實施是有效,因此

PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=cpp python -c "from google.protobuf.internal import api_implementation; print(api_implementation._default_implementation_type)" 

PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION=python python -c "from google.protobuf.internal import api_implementation; print(api_implementation._default_implementation_type)" 

將始終顯示同樣的結果。

要查看其執行是積極的,而不是使用:

python -c "from google.protobuf.internal import api_implementation; print(api_implementation.Type())" 

更改PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION環境變量將導致Type()結果來改變它沒有爲_default_implementation_type

+0

解決了混亂!謝謝。 – user3504575

+0

看來,如果從源代碼安裝,Tensorflow總是調用cpp protobuf。因爲在將PROTOCOL_BUFFERS_PYTHON_IMPLEMENTATION設置爲python之後,我仍然會得到「大於67108864字節的大協議消息...」。雖然protobuf 3.3.0應該使用BytesLimit = 2G。 – samuel

1

嘗試以下操作:

$ python -c "from google.protobuf.internal import api_implementation; print(api_implementation._default_implementation_type)" 

應該打印要麼pythoncpp

+0

謝謝!它說'python'。我假設我無法通過這種設置獲得最佳表現? – user3504575

+0

我能夠通過簡單地重命名軟件包來安裝pip軟件包。 wget https://storage.googleapis.com/tensorflow/linux/cpu/protobuf-3.0.0b2.post2-cp34-none-linux_x86_64.whl mv protobuf-3.0.0b2.post2-cp34-none-linux_x86_64。 whl protobuf-3.0.0b2.post2-cp35-none-linux_x86_64.whl pip install x86_64.whl protobuf-3.0.0b2.post2-cp35-none-linux_x86_64.whl 它仍然說我正在使用'python'。這裏發生了什麼? – user3504575