Ubuntu上安装python3.7.0版本,执行到make命令有两个modules build failed,请问如何解决呢?

安装python3.7.0版本报错,请问如何解???

1、操作步骤:

(1)解压了Python-3.7.0的压缩包

(2)cd Ptyhon-3.7.0

(3)./configure --with-openssl=/opt/openssl-1.0.2.q

(4)make

(5)make install

2、执行到第(4)步make命令后出现以下错误:
图片说明

Building '_ssl' extension

/usr/bin/ld: /opt/openssl-1.0.2q/lib/libssl.a(s3_meth.o):relocation R_X86_64_32 against '.radata' can not be used when making a shared object; recompile with -fPIC

/opt/openssl-1.0.2q/lib/libssl.a:error adding symbols:Bad value

collect2: error: ld returned 1 exit status

Building '_hashlib' extension

/usr/bin/ld: /opt/openssl-1.0.2q/lib/libcrypto.a(o_name.o_): relocation R_X86_64_32 against '.text' can not be used when making a shared object; recompile eith -fPIC

/opt/openssl-1.0.2q/lib/libcrypto.a: error adding symbols: Bad value

Collect2: error: ld returned 1 exit status

The necessary bits to build these optional modules were not found:
_bz2 _lzma _uuid readline

Failed to build these modules:_hashlib _ssl

Could not build the ssl module!

Python requires an OpenSSL1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().

LibreSSL 2.6.4 and earlier do not privide the neceaary APIs, https://github.com/libressl-portable/portable/issues/381

3备注:不知这报错是不是什么依赖环境没安装好,前面预安装了openssl-1.0.2q,不过查看用命令:openssl version查看了openssl的版本不是openssl-1.0.2q,而是系统自带的那个版本;但是在/opt目录下看到有openssl-1.0.2q。遇到这错误如何解决呢????

在出现了上面的错误之后我再执行第(5)步,第5步没有报错,但是用python -V查看此时的python版本,仍然是原来自带的python 2.7.6,不是现在安装的python 3.7.0,请问是没有安装成功吗??????

刚接触这些东西是小白一个,费了一天多的时间也没能把问题解决,遇到过这样的情况并解决了的朋友帮忙解答一下,拜托了~~

......

试试 python3 -V 。
Linux 中 python是分为 python2 和 python3的,你用 python 开头的命令 只能对应python2的版本,用python3 开头的命令才是3的版本。
所以终端中 进入python交互模式的命令也是:python3,在线安装python的包用的是 pip3 install xxx
另外,现在新装的Ubuntu都是直接自带python3的

https://www.cnblogs.com/-Neo/p/11143708.html 此链接可能对你有帮助