我是 Odoo 的新手。我使用 pyenv 来托管 odoo 和所有依赖项。都在 odoo 系统用户下,我能够启动 odoo 服务:
~# systemctl status odoo-15
● odoo-15.service - Odoo15
Loaded: loaded (/etc/systemd/system/odoo-15.service; enabled; vendor preset: enabled)
Active: active (running) since Fri 2022-02-18 22:33:40 UTC; 6min ago
Main PID: 61267 (python)
Tasks: 6 (limit: 2339)
Memory: 79.3M
CGroup: /system.slice/odoo-15.service
└─61267 /home/odoo/.pyenv/versions/odoo-15-env/bin/python /home/odoo/odoo-15/odoo-bin -c /home/odoo/.odoo_config
但是,由于 PyPDF2 找不到,该服务似乎总是在大约 1 小时后自动停止:
Feb 18 16:10:28 ubuntu-s-1vcpu-2gb-sgp1-odoo systemd[1]: Started Odoo15.
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: Traceback (most recent call last):
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: File "/home/odoo/odoo-15/odoo-bin", line 5, in <module>
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: import odoo
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: File "/home/odoo/odoo-15/odoo/__init__.py", line 75, in <module>
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: import PyPDF2
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo odoo-15[58346]: ModuleNotFoundError: No module named 'PyPDF2'
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo systemd[1]: odoo-15.service: Main process exited, code=exited, status=1/FAILURE
Feb 18 17:19:32 ubuntu-s-1vcpu-2gb-sgp1-odoo systemd[1]: odoo-15.service: Failed with result 'exit-code'.
但我的 pyenv 中肯定有 PyPDF2
odoo@ubuntu-s-1vcpu-2gb-sgp1-odoo:~/odoo-15$ python
Python 3.9.2 (default, Feb 17 2022, 17:59:57)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import PyPDF2
>>> PyPDF2.__version__
'1.26.0'
我觉得这与我的 virtualenv 配置有关,但我在这里有点迷失了。
你能帮我解释一下这里可能出了什么问题吗?谢谢