centos6.5安装python3.7和opencv-python记录

之前自己做实验全部用的centos7版本的系统,现在要部署到指定服务器,而指定的服务器确是centso6.5版本,因此本来两个命令即可解决的事情,最后遇到了那么多问题需要解决。

1、问题:ModuleNotFoundError: No module named '_ctypes'

解决办法:

yum install libffi-devel -y #有疑问,可能不行

wget http://mirror.centos.org/centos/7/os/x86_64/Packages/libffi-devel-3.0.13-18.el7.x86_64.rpm

rpm -ivh libffi-devel-3.0.13-18.el7.x86_64.rpm

再make install #只的是对python3.7

2、问题:pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting virtualenv
Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/
Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/
Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/
Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/
Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/virtualenv/
Could not fetch URL https://pypi.org/simple/virtualenv/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/virtualenv/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
Could not find a version that satisfies the requirement virtualenv (from versions: )
No matching distribution found for virtualenv
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

解决办法:

wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz

tar -zxvf openssl-1.1.1a.tar.gz

cd openssl-1.1.1a

./config --prefix=/usr/local/openssl no-zlib

make

make install

mv /usr/bin/openssl /usr/bin/openssl.bak #可直接删除,不留备份

mv /usr/include/openssl/ /usr/include/openssl.bak #可直接删除,不留备份

ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl

echo "/usr/local/openssl/lib" >> /etc/ld.so.conf

ldconfig -v

openssl version

ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/lib64/libssl.so.1.1

ln -s /usr/local/openssl/lib/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

重新编译python.

3、问题:centos ImportError: libSM.so*: cannot open shared object file:

解决办法:

yum whatprovides libSM.so.6

yum install libSM* --setopt=protected_multilib=false

4、问题:centos ImportError: libXrender.so.1: cannot open shared object file:

解决办法:

yum install libXrender

5、问题:centos ImportError: libXrender.so.1: cannot open shared object file:

解决办法:yum install libXext

6、python3.7安装步骤:

   yum -y groupinstall "Development tools"
   yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel 
   yum -y install db4-devel libpcap-devel xz-devel
   yum install libffi-devel -y
   wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
   tar -xvJf  Python-3.7.0.tar.xz
   mkdir /usr/local/python3
   cd Python-3.7.0
   ./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl --enable-optimizations
   make && make install
   python3 -V
   ln -s /usr/local/python3/bin/python3 /usr/local/bin/python3
   ln -s /usr/local/python3/bin/pip3 /usr/local/bin/pip3
   python3 -V
   pip3 -V

7、安装服务依赖:

pip3 install -U werkzeug

pip3 install gunicorn

pip3 install requests

8、注意:

所有安装包在安装之前都要检查有没有把之前的老版本清理干净。

 

  • 2
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值