python2.7.5


 

 

 ./configure --prefix=/usr/local/python2.7.5

 

gcc -pthread  -Xlinker -export-dynamic -o python \
                Modules/python.o \
                libpython2.7.a -lpthread -ldl  -lutil   -lm  
libpython2.7.a(posixmodule.o): In function `posix_tmpnam':
/root/Python-2.7.5/./Modules/posixmodule.c:7515: warning: the use of `tmpnam_r' is dangerous, better use `mkstemp'
libpython2.7.a(posixmodule.o): In function `posix_tempnam':
/root/Python-2.7.5/./Modules/posixmodule.c:7462: warning: the use of `tempnam' is dangerous, better use `mkstemp'
./python -E -S -m sysconfig --generate-posix-vars
Could not find platform dependent libraries <exec_prefix> Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] make: *** [Makefile:464: pybuilddir.txt] Segmentation fault (core dumped)
[root@host-10-10-18-131 Python-2.7.5]# ls /usr/local/python2.7.5
[root@host-10-10-18-131 Python-2.7.5]# ls /usr/local/python2.7.5/
[root@host-10-10-18-131 Python-2.7.5]# ls /usr/local/python2.7.5/ -al

 

解決:

查看Python路徑相關環境變量的意義。

  • PYTHONHOME :指定 Python 的標准庫。
  • PYTHONPATH :用於擴充 Python 查找模塊文件的路徑。

這里是導入 site 模塊時出錯,所以應該在 PYTHONPATH 上增加 site 模塊的路徑。

查找site相關文件的路徑:

[root@tZ etc]# find / -name site.py*
/usr/lib64/python2.7/site.pyc
/usr/lib64/python2.7/site.py
/usr/lib64/python2.7/site.pyo

增加路徑到環境變量:

[root@host-10-10-18-131 Python-2.7.5]# export PYTHONPATH=$PYTHONPATH:/usr/local/python2.7.5
[root@host-10-10-18-131 Python-2.7.5]# make -j 4
./python -E -S -m sysconfig --generate-posix-vars
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
make: *** [Makefile:464: pybuilddir.txt] Segmentation fault (core dumped)
[root@host-10-10-18-131 Python-2.7.5]# ls /usr/local/
bin  etc  games  include  lib  lib64  libexec  python2.7.5  sbin  share  src
[root@host-10-10-18-131 Python-2.7.5]# mkdir -p /usr/local/python2.7
[root@host-10-10-18-131 Python-2.7.5]# ./configure --prefix=/usr/local/python2.7

 


免責聲明!

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



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