./configure --prefix=/usr/local/python3 --enable-optimizations --with-openssl=/usr/local/openssl
gcc -pthread -Xlinker -export-dynamic -o python Programs/python.o libpython3.6m.a -lpthread -ldl -lutil -lrt -lm
./python -E -S -m sysconfig –generate-posix-vars ;\
if test $? -ne 0 ; then \
echo “generate-posix-vars failed” ; \
rm -f ./pybuilddir.txt ; \
exit 1 ; \
fi
Fatal Python error: Py_Initialize: Unable to get the locale encoding
LookupError: unknown encoding: GB2312
Current thread 0x00007fd09a00f700 (most recent call first):
/bin/sh: line 5: 15089 ????? ./python -E -S -m sysconfig –generate-posix-vars
generate-posix-vars failed
make: *** [pybuilddir.txt] ?? 1
解决方法:
在 ./configure
操作前,先进行配置:
export LANGUAGE=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_ALL=en_US.UTF-8
如果未解决
降低版本值8 或者 7
或者编译的时候 去除 --enable-optimizations