在Ubuntu 16.04中给Docker构建的Ubuntu容器

2020-03-30  本文已影响0人  AuraMIXdopE

没错就是超级套娃😂,但是迫于实验精神【突发奇想】需要也只能强行往上套,然后就发现了很多很多很多...错误,下面是亲测有效的安装方法【⚠️容器的Ubuntu未安装一切必要依赖,在MacBook Pro 2017上通过】

1. 安装gcc编译器

# 由虚拟机进入容器
1. sudo docker exec -it test_1 /bin/bash

# apt更新
# 报错则用apt-get update --bfix-missing
2. apt update

# 安装gcc
# 查看gcc版本信息:gcc --version
###### 此步骤时间较长
3. apt install build-essential

2.安装Python3

2.1 在官网下载源码Python-3.x.x.tgz并将源码由虚拟机复制到容器目录下

# sudo docker cp src container_name/id:path_to_python
sudo docker cp Python-3.7.6.tgz test_1:/home/python3

2.2 进入容器对应目录进行make安装【错误来袭】

# make时可能会报错缺少zlib,先安装zlib及其依赖
apt install zlibc zlib1g-dev
make && make install

【问题1】SSL证书问题,不能连接到网站

Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")
./configure --with-ssl
make && make install

【问题2】SSL版本过低

Could not build the ssl module! Python requires an OpenSSL 1.0.2 or 1.1 compatible libssl with X509_VERIFY_PARAM_set1_host().LibreSSL 2.6.4 and earlier do not provide the necessary APIs, https://github.com/libressl-portable/portable/issues/381
tar -zxvf libressl-2.7.4.tar.gz
cd libreSSL-2.7.4
./config –prefix=/usr/local/lib
make && make install
cd /usr/local/lib
1. cd /etc/ld.so.conf.d

# 新建文件,将libssl库安装路径加入文件中,保存并退出
# 文件内容: /usr/local/lib
2. vim libressl-2.7.4.conf 

3. 执行 ldconfig -v  重新加载库文件
4. 查看openssl的版本:openssl version

【问题3】缺少_ctypes模块

No module named '_ctypes'

3. 大功告成,测试python3pip3


  1. 参考自libreSSL安装.

上一篇下一篇

猜你喜欢

热点阅读