在linux平台下编译python时只需要3条命令.
编译步骤
在github或https://www.python.org/downloads/中下载python源码
解压压缩包进路目录执行
1. ./configure --prefix=你想安装python的全路径 [--enable-shared在bin目录下生成libpython版本号,so文件 编译成动态链接可选]
2. make
3. make install
编译出现的错:
在第2个命令make是可能出现错误
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -c ./Modules/xxsubtype.c -o Modules/xxsubtype.o
gcc -pthread -c -fno-strict-aliasing -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -I. -I./Include -DPy_BUILD_CORE -DSVNVERSION=\"`LANG=C svnversion .`\" -o Modules/getbuildinfo.o ./Modules/getbuildinfo.c
gcc: error: directory": 没有那个文件或目录
make: *** [Modules/getbuildinfo.o] 错误 1
这里说的是svn的版本好出问题了,解决方法1.
编辑Makefile 将的SVNVERSION设置为"", 即SVNVERSION=""
解决方案2.