linux 下編譯python
阿新 • • 發佈:2022-04-12
1. 下載Python原始碼
到 https://www.python.org/ftp/python/ 上下載與電腦對應版本的Python
2. 編譯
執行下列命令編譯安裝--prefix
設定安裝的位置,便於管理
./configure --host=arm-linux --build=arm-linux-gnueabihf ac_cv_file__dev_ptmx=no ac_cv_file__dev_ptc=no --disable-ipv6 --prefix=/home/apps/python3
host與本機的arm庫路徑名稱一致
2.1. 編譯中遇到的錯誤
- 遇到錯誤
configure: error: readelf for the host is required for cross builds
看樣子是缺少readelf這個檔案
在arm-gcc的bin目錄下發現一個arm-linux-gnueabihf-readelf
,在此目錄執行
ln -s arm-linux-gnueabihf-readelf arm-linux-readelf
-
遇到錯誤
Fatal: You must get working getaddrinfo() function. or you can specify "--disable-ipv6".
因為用不到IPv6,所以在configure後面加上--disable-ipv6
-
configure: error: set ac_cv_file__dev_ptmx to yes/no in your CONFIG_SITE file when cross compiling
在configure後面加上ac_cv_file__dev_ptmx=no
即可 -
configure: error: set ac_cv_file__dev_ptc to yes/no in your CONFIG_SITE file when cross compiling
同樣加上ac_cv_file__dev_ptc=no
-
configure: error: cannot run C compiled programs. If you meant to cross compile, use '--host'.
交叉編譯需要設定--host
、--build
兩個引數
作者:uenigma
連結:https://www.jianshu.com/p/7346cc4e41ac
來源:簡書
著作權歸作者所有。商業轉載請聯絡作者獲得授權,非商業轉載請註明出處。