装redis:
yum install redis -y
配置:
vim /etc/redis.conf
输入 ?requirepass
输入 i 进行编辑,设密码:
esc 或者ctrl+c退出:
:wq 表示保存退出
启动:
systemctl start redis
systemctl restart redis
开机自启:
systemctl enable redis
装python3.10解释器:
先装依赖:
yum install gcc zlib zlib-devel bzip2 bzip2-devel ncurses ncurses-devel readline readline-devel openssl openssl-devel xz lzma xz-devel sqlite sqlite-devel gdbm gdbm-devel tk tk-devel mysql-devel python-devel libffi-devel -y
安装解释器:
cd /data/
wget https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tgz
可以wget +url,博主这里用rz上传
看到这里你可以不用操作了,直接按照小标题"参考"的方法。
我发现有openssl的问题,pip,虚拟环境有问题。如果升级的话不用源码装git,也会报错。直接yum install git -y
仅做演示
编译并安装
tar -xvf Python-3.10.8.tgz
依次输入:
cd Python-3.10.8
./configure
make all
make install
请耐心等待
配置:
输入python3 --version看看成功没有
pip3.10 config set global.index-url https://pypi.douban.com/simple/
我这里pip install的时候报错了:
输入:
pip3 install -i http://pypi.douban.com/simple/ pip -U --trusted-host pypi.douban.com
我之后又装了一遍,看了看pip.conf,发现不用装。腾讯云自己配置了源,多半是故意弄的
虚拟环境:
pip3 install virtualenv
mkdir envs
cd envs/
virtualenv /envs/nb --python=python3.10
但是我这里依然没解决no module named '_ssl'的问题
参考:
考虑有些伙伴不方便,我把命令copy一份
> yum update
> yum install openssl-devel bzip2-devel libffi-devel
> yum groupinstall "Development Tools"
> cd /usr/src
> wget https://ftp.openssl.org/source/openssl-1.1.1q.tar.gz --no-check-certificate
> tar -xzvf openssl-1.1.1q.tar.gz
> cd openssl-1.1.1q
> ./config --prefix=/usr --openssldir=/etc/ssl --libdir=lib no-shared zlib-dynamic
> make
> make test
> make install
> openssl version
OpenSSL 1.1.1q 5 Jul 2022
> which openssl
/usr/bin/openssl
> cd /usr/src
>wget https://www.python.org/ftp/python/3.10.8/Python-3.10.8.tgz
tar -xzf Python-3.10.8.tgz
cd Python-3.10.8
> ./configure --enable-optimizations --with-openssl=/usr
> make altinstall
#检查版本
python3.10
pip3 install virtualenv
mkdir envs
cd envs/
virtualenv /envs/nb --python=python3.10
激活:
source /envs/nb/bin/activate
亲测有效,国内的社区太垃圾了
标签:为例,--,openssl,devel,3.10,install,linux,python,django From: https://blog.51cto.com/u_16172166/7152823