gcc -pthread -Xlinker -export-dynamic -o Programs/_testembed Programs/_testembed.o libpython3.6m.a -lpthread -ldl -lutil -lm
# Substitution happens here, as the completely-expanded BINDIR
# is not available in configure
sed -e "s,@EXENAME@,/usr/local/python3/bin/python3.6m," < ./Misc/python-config.in >python-config.py
# Replace makefile compat. variable references with shell script compat. ones; ->
LC_ALL=C sed -e 's,\$(\([A-Za-z0-9_]*\)),\$\{\1\},g' < Misc/python-config.sh >python-config
# On Darwin, always use the python version of the script, the shell
# version doesn't use the compiler customizations that are provided
# in python (_osx_support.py).
if test `uname -s` = Darwin; then \
cp python-config.py python-config; \
fi
[root@Python36 Python-3.6.6]#
直接根据提示运行上面给的命令,然后再make:
[root@Python36 Python-3.6.6]# sed -e "s,@EXENAME@,/usr/local/python3/bin/python3.6m," < ./Misc/python-config.in >python-config.py
[root@Python36 Python-3.6.6]# make
CC='gcc -pthread' LDSHARED='gcc -pthread -shared ' OPT='-DNDEBUG -g -fwrapv -O3 -Wall' _TCLTK_INCLUDES='' _TCLTK_LIBS='' ./python -E ./setup.py build
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
warning: building with the bundled copy of libffi is deprecated on this platform. It will not be distributed with Python 3.7
Python build finished successfully!
The necessary bits to build these optional modules were not found:
_bz2 _curses _curses_panel
_dbm _gdbm _lzma
_sqlite3 _ssl _tkinter
readline zlib
To find the necessary bits, look in setup.py in detect_modules() for the module's name.
The following modules found by detect_modules() in setup.py, have been
built by the Makefile instead, as configured by the Setup files:
atexit pwd time
running build_scripts
copying and adjusting /root/download/Python-3.6.6/Tools/scripts/pydoc3 -> build/scripts-3.6
copying and adjusting /root/download/Python-3.6.6/Tools/scripts/idle3 -> build/scripts-3.6
copying and adjusting /root/download/Python-3.6.6/Tools/scripts/2to3 -> build/scripts-3.6
copying and adjusting /root/download/Python-3.6.6/Tools/scripts/pyvenv -> build/scripts-3.6
changing mode of build/scripts-3.6/pydoc3 from 644 to 755
changing mode of build/scripts-3.6/idle3 from 644 to 755
changing mode of build/scripts-3.6/2to3 from 644 to 755
changing mode of build/scripts-3.6/pyvenv from 644 to 755
renaming build/scripts-3.6/pydoc3 to build/scripts-3.6/pydoc3.6
renaming build/scripts-3.6/idle3 to build/scripts-3.6/idle3.6
renaming build/scripts-3.6/2to3 to build/scripts-3.6/2to3-3.6
renaming build/scripts-3.6/pyvenv to build/scripts-3.6/pyvenv-3.6
[root@Python36 Python-3.6.6]#
make 成功后就是 make install :
[root@Python36 Python-3.6.6]# make install 验证
直接先运行python3,再确认一下版本信息:
[root@Python36 ~]# cd /usr/local/python3/
[root@Python36 python3]# ./bin/python3
Python 3.6.6 (default, Sep 29 2018, 16:19:00)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-28)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> exit()
[root@Python36 python3]#
退出用 exit()
[root@Python3 ~]# cd /etc/yum.repos.d/
[root@Python3 yum.repos.d]# mkdir bak
[root@Python3 yum.repos.d]# mv *.repo bak
[root@Python3 yum.repos.d]# ls
bak
现在文件夹已经空了,去下载yum源的repo文件,我用的是阿里的源: