如题,博主废了不少劲,折腾了一个上午终于搞定了
本次采用环境是ubuntu1804系统的docker容器,并且容器内部已更换阿里源
编辑阿里源:
vi /etc/apt/sources.list
然后粘贴下面内容,再保存
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
然后依次执行下方命令
apt-get update
apt install software-properties-common
add-apt-repository ppa:deadsnakes/ppa
apt-get update
apt install python3.8 python3.8-dev python3.8-distutils python3.8-venv
将 python3.6 和 3.8 添加到 update-alternatives
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.6 1
sudo update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 2
> sudo update-alternatives --config python3
There are 2 choices for the alternative python3 (providing /usr/bin/python3).
Selection Path Priority Status
------------------------------------------------------------
* 0 /usr/bin/python3.8 2 auto mode
1 /usr/bin/python3.6 1 manual mode
2 /usr/bin/python3.8 2 manual mode
Press <enter> to keep the current choice[*], or type selection number:
可以看到,已经默认指向了 python3.8,按回车即可。
测试一下,可以看到指向已更新。
> python3
Python 3.8.0 (default, Dec 9 2021, 17:53:27)
接下来安装pip适用于python3.8的版本
python3 -m ensurepip
python3 -m pip install --upgrade pip setuptools wheel
sudo apt install --fix-missing python3-pip
再输入pip3不报错就是对了
#输入
pip3 -V
#显示
pip 22.0.4 from /usr/local/lib/python3.8/dist-packages/pip (python 3.8)
换源,准备装odoo14的依赖
pip3 config set global.index-url https://mirrors.aliyun.com/pypi/simple/
# 自行切换到odoo14 requirements.txt所在目录后执行下面语句
python3 -m pip install psycopg2-binary
sudo apt install python3-dev libpq-dev
sudo apt-get install python3-psycopg2
pip3 install -r requirements.txt
下面是odoo14适配的requirements.txt的内容
Babel==2.6.0
chardet==3.0.4
decorator==4.3.0
docutils==0.14
ebaysdk==2.1.5
feedparser==5.2.1; sys_platform == 'win32'
feedparser; sys_platform != 'win32'
freezegun==0.3.11; python_version < '3.8'
freezegun==0.3.15; python_version >= '3.8'
gevent==1.1.2 ; sys_platform != 'win32' and python_version < '3.7'
gevent==1.5.0 ; python_version == '3.7'
gevent==20.9.0 ; python_version >= '3.8'
gevent==1.4.0 ; sys_platform == 'win32' and python_version < '3.7'
greenlet==0.4.10 ; python_version < '3.7'
greenlet==0.4.15 ; python_version == '3.7'
greenlet==0.4.17 ; python_version > '3.7'
html2text==2018.1.9
idna==2.6
Jinja2==2.10.1; python_version < '3.8'
# bullseye version, focal patched 2.10
Jinja2==2.11.2; python_version >= '3.8'
libsass==0.17.0
lxml==3.7.1 ; sys_platform != 'win32' and python_version < '3.7'
lxml==4.3.2 ; sys_platform != 'win32' and python_version == '3.7'
lxml==4.6.1 ; sys_platform != 'win32' and python_version > '3.7'
lxml ; sys_platform == 'win32'
Mako==1.0.7
MarkupSafe==1.1.0
num2words==0.5.6
ofxparse==0.19
passlib==1.7.1; sys_platform != 'win32' and python_version < '3.8'
passlib==1.7.2; sys_platform == 'win32' or python_version >= '3.8'
Pillow==5.4.1 ; python_version <= '3.7' and sys_platform != 'win32'
Pillow==6.1.0 ; python_version <= '3.7' and sys_platform == 'win32'
Pillow==8.1.1 ; python_version > '3.7'
polib==1.1.0
psutil==5.6.6
psycopg2==2.7.7; sys_platform != 'win32' and python_version < '3.8'
psycopg2==2.8.5; sys_platform == 'win32'
psycopg2; sys_platform != 'win32' and python_version >= '3.8'
pydot==1.4.1
python-ldap==3.1.0; sys_platform != 'win32'
PyPDF2==1.26.0
pyserial==3.4
python-dateutil==2.7.3
pytz==2019.1
pyusb==1.0.2
qrcode==6.1
reportlab==3.5.13; python_version < '3.8'
reportlab==3.5.55; python_version >= '3.8'
requests==2.21.0
zeep==3.2.0
python-stdnum==1.8
vobject==0.9.6.1
Werkzeug==0.16.1
XlsxWriter==1.1.2
xlwt==1.3.*
xlrd==1.1.0; python_version < '3.8'
xlrd==1.2.0; python_version >= '3.8'
pypiwin32 ; sys_platform == 'win32'
上面操作完毕后将odoo14的源码放到容器内,比如 /home/odoo/odoo14/ 这个目录
然后给odoo-bin文件可执行文件权限
chmod +x ./odoo-bin
接下来只需要运行项目
/home/odoo/odoo14/odoo-bin -c /etc/odoo/odoo.conf
其中 /etc/odoo/odoo.conf这个文件是odoo的配置 文件,玩odoo的都 懂,涉及隐私就不贴代码了
如果报错缺哪个模块就是pip3 install该模块完事儿
可能有用的命令:
rm -rf /usr/local/bin/odoo
ln -s /home/shell/odoo.sh /usr/local/bin/odoo