python源码安装及基础设置
- 1、资源下载
- 2、源码安装
- 3、 yum安装pip
- 4、pip安装虚拟环境
- 1、安装虚拟环境库
- 2、配置环境变量
- 3、创建自己的虚拟环境
- 5、安装升级pip的两种方式
- 1、get-pip.py升级
- 2、安装源码升级
- 6、odoo部署
1、资源下载
python3.13
python版本库
2、源码安装
yum groupinstall "Development Tools"
tar 解压
#配置
./configure --prefix=/usr/local/python3.13
#编译
make && make install
#备份
mv /usr/bin/python /usr/bin/python-bak
#软连接
ln -s /usr/local/python3.13/bin/python3.13 /usr/bin/python
#修改执行文件
vim /usr/libexec/urlgrabber-ext-down
vim /usr/bin/yum
修改#!/usr/bin/python为#!/usr/bin/python2
python --version
ubuntu
apt install gcc cmake zlib1g-dev python3-pip
## 重复编译安装python
ln -s /usr/local/python3.10/bin/python3.10 /usr/bin/python
vim /etc/apt/sources.list
#添加清华源
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ focal-security main restricted universe multiverse multiverse
3、 yum安装pip
yum install python3-pip
mkdir ~/.pip
cat << EOF > ~/.pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple/
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn
EOF
###python -m ensurepip基本不用
4、pip安装虚拟环境
1、安装虚拟环境库
pip3 install virtualenv
pip3 install virtualenvwrapper
2、配置环境变量
vim ~/.bashrc
export WORKON_HOME=$HOME/.virtualenvs
export PROJECT_HOME=$HOME/workspace
source /usr/local/bin/virtualenvwrapper.sh
source ~/.bashrc
3、创建自己的虚拟环境
mkvirtualenv -p python3.13 <虚拟环境名>
mkvirtualenv -p python3.13 fandx_odoo
或者
python3 -m venv tutorial_env
5、安装升级pip的两种方式
1、get-pip.py升级
yum remove python3-pip
yum install python3-devel
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
python get-pip.py
python3 -m pip install setuptools
python3 -m pip install --upgrade setuptools
python3 -m pip install --upgrade pip
python3 -m pip --version
2、安装源码升级
官网:
pip-24下载链接
tar -zxvf pip-24.0.tar.gz && cd pip-24.0/
python3 setup.py install
[root@test pip-24.0]# python -m pip --version
pip 23.2.1 from /usr/local/python3.11/lib/python3.11/site-packages/pip (python 3.11)
6、odoo部署
注:Odoo 需要 Python 3.10 或更高版本才能运行。
cd /usr/bin/
ln -s python3.10 python
#数据库安装
apt install postgresql -y
sudo -i -u postgres
psql
create user fandx_odoo;
alter user fandx_odoo with password 'fandx_password';
alter user fandx_odoo createdb;
#修改postgresql的连接策略
cd /etc/postgresql/版本/main/
vim postgresql.conf
listen_addresses = '*'
max_connections = 300
vim pg_hba.conf
# IPv4 local connections:
host all all 127.0.0.1/32 scram-sha-256
host all all 0.0.0.0/0 md5
systemctl restart postgresql
systemctl status postgresql
ss -nutlp | grep 5432
##添加odoo安装源
wget -q -O - https://nightly.odoo.com/odoo.key | sudo gpg --dearmor -o /usr/share/keyrings/odoo-archive-keyring.gpg
echo 'deb [signed-by=/usr/share/keyrings/odoo-archive-keyring.gpg] https://nightly.odoo.com/17.0/nightly/deb/ ./' | sudo tee /etc/apt/sources.list.d/odoo.list
apt update
#安装依赖、下载地址(根据自己的版本下载)
https://github.com/wkhtmltopdf/packaging/releases/tag/0.12.6.1-3
dpkg -i wkhtmltox_0.12.6.1-3.jammy_amd64.deb
#安装odoo
apt install odoo
#修改配置重启
systemctl restart odoo
systemctl status odoo
#安装插件
apt-get install ttf-wqy-zenhei
apt-get install ttf-wqy-microhei
登录默认密码:
账号邮箱:
设置的数据库密码:fandx_password
登陆之后如果没有更改到中文则在以下设置: