ImportError: /lib64/libc.so.6: version `GLIBC_2.17' 問題解決
阿新 • • 發佈:2019-01-14
安裝最新的TensorFlow(>=1.10)後,載入TensorFlow時提示Glibc版本過低,需要升級到指定版本。
ImportError: /lib64/libc.so.6: version `GLIBC_2.17' not found (required by /usr/local/python3.6/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow.so)
1、下載、解壓:
cd /usr/local wget https://ftp.gnu.org/gnu/glibc/glibc-2.17.tar.gz tar -zxvf glibc-2.17.tar.gz
在 https://ftp.gnu.org/gnu/glibc/ 或者 http://ftp.twaren.net/Unix/GNU/gnu/libc/ 裡選擇下載 對應版本.
2、編譯、安裝:
cd glibc-2.17
./configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
此時報如下錯誤資訊:
意思為必須在一個新目錄下編譯。解決方法:新建一個目錄,然後進入該目錄,用絕對路徑編譯。
cd /usr/local/glibc-2.17 mkdir build cd build ../configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin
然後
# make
# make install
3、到這一步如果出現ls目錄不能使用,則/lib64/libc.so.6未更新。需要重建軟連線,但是先解決命令不能使用問題。
命令恢復:
# LD_PRELOAD=/lib64/libc-2.17.so
設定軟連線,先刪除舊的:
# rm /lib64/libc.so.6
# ln -s /lib64/libc-2.17.so /lib64/libc.so.6
檢視glib詳情,執行:
# strings /lib64/libc.so.6 |grep GLIBC_ GLIBC_2.2.5 GLIBC_2.2.6 GLIBC_2.3 GLIBC_2.3.2 GLIBC_2.3.3 GLIBC_2.3.4 GLIBC_2.4 GLIBC_2.5 GLIBC_2.6 GLIBC_2.7 GLIBC_2.8 GLIBC_2.9 GLIBC_2.10 GLIBC_2.11 GLIBC_2.12 GLIBC_2.13 GLIBC_2.14 GLIBC_2.15 GLIBC_2.16 GLIBC_2.17 GLIBC_PRIVATE
可以看到支援的最高版本。
4、檢查:
# ldd --version
ldd (GNU libc) 2.17
Copyright (C) 2012 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.
參考: