python --enable-shared


https://github.com/docker-library/python/issues/21

例如編譯安裝python3.5.2,腳本如下:

wget https://s3.cn-north-1.amazonaws.com.cn/zeusis/packages/Python-3.5.2.tgz
tar -xf Python-3.5.2.tgz
cd Python-3.5.2
./configure --prefix=/usr/local --enable-shared
make
make install

 

其中 ./configure --prefix=/usr/local --enable-shared  中的 --enable-shared 很重要。

啟用共享,方便其他依賴python的一些內置庫(比如 mysqlclient) 的資源的正常安裝; 不啟用可能報以下錯誤:

...
command 'gcc' failed with exit status 1

 

When running configure, you should be supplying the --enable-shared option to ensure that shared libraries are built for Python. By not doing this you are preventing any application which wants to use Python as an embedded environment from working. This is because the lack of the shared library results in any embedded system failing at compile time with:

...
error: command 'gcc' failed with exit status 1

 

ps:

ldconfig可用於解決python運行時so庫找不到的問題。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM