Centos默认安装的是Python2,所以一般会去安装Python3。所以往往需要自己去官方下载Python3来编译安装。具体安装过程,网上一堆,就不多说了。
这里说一下,编译过程中容易出现被忽略的警告的信息。因为即使出现警告,后续也不会影响Pyhton3安装的,据说也不会影响python使用。但如果你有强迫症,那么可以用如下办法解决。
解决办法:编译前先执行安装:yum install -y libffi libffi-devel
之后再编译,一般就不会出现警告了。
以下是出现的警告信息:
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c: In function 'classify_argument':
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:195:18: warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
FFI_ASSERT (0);
^
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:224:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < words; i++)
^
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:245:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < num; i++)
^
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:264:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 1; i < words; i++)
^
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:270:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < words; i++)
^
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c: In function 'examine_argument':
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:323:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (i = 0; i < n; ++i)
^
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c: In function 'ffi_call':
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:484:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = 0; j < n; j++, a += 8, size -= 8)
^
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c: In function 'ffi_closure_unix64_inner':
/usr/src/Python-3.6.0/Modules/_ctypes/libffi/src/x86/ffi64.c:659:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (j = 0; j < n; j++, a += 8)
写的很好,很喜欢