安装python连接eureka并且vector search milvus centos7
(一)先安装python到centos7
第一步:
安装必要的软件包,使用root权限:
yum groupinstall -y "Development tools"
yum install -y ncurses-devel gdbm-devel xz-devel sqlite-devel tk-devel uuid-devel readline-devel bzip2-devel libffi-devel
第二步:
Python官方地址:
本文安装Python3.10.6
新建目录并下载源码包并解压:
mkdir python
cd python
wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz
tar xzf Python-3.10.6.tgz
cd Python-3.10.6
第三步:
编译安装
./configure
make
make install
本文使用默认配置安装,安装后可执行文件在/usr/local/bin,将该目录添加至环境变量:
PATH=$PATH:$HOME/bin:/usr/local/bin
export PATH
重新载入环境变量:
source ~/.bash_profile
Python3.10.6安装完毕:
Python 3.10.6 (main, Sep 15 2022, 10:01:37) [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
(二)先安装python到centos7
在vscode中执行 pipreqs . --encoding=utf8 --force
生成 requirements.txt
然后把python_eureka打包zip上传到centos
然后 unzip python_eureka.zip
然后 pip3 install -r requirements.txt
注意到这一步骤执行pip3 install的时候可能出现如下错误
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
因为centos自带的OpenSSL 1.0.2k-fips 26 Jan 2017 版本太老,需要执行如下步骤
安装Yum源
yum install -y epel-release
依赖工具下载
yum install -y gcc patch libffi-devel python-devel zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel wget
编译OpenSSL源码
Python3.10.6编译需要使用OpenSSL版本1.1.1的源码使用wget下载
wget https://www.openssl.org/source/openssl-1.1.1s.tar.gz --no-check-certificate
解压编译openssl
tar zxf openssl-1.1.1s.tar.gz
cd openssl-1.1.1s
./config --prefix=/opt/openssl --openssldir=/opt/openssl/openssl no-zlib
make -j 8 && make install
添加到动态库
echo "/opt/openssl/lib" >> /etc/ld.so.conf
ldconfig -v
修改启动SSL功能
cd Python-3.10.6
make clean
./configure --with-openssl=/opt/openssl --with-openssl-rpath=auto
进行编译安装
make
make install
然后再执行 pip3 install -r requirements.txt
就不会报错了
然后vim startpy_eureka.sh
nohup python3 python_eureka.py >> python_eureka.log 2>&1 &
保存后chmod 755 startpy_eureka.sh