Psycopg2 在 Ubuntu 20.04 上安装 Odoo 13 时出错
Psycopg2 Error installing Odoo 13 on Ubuntu 20.04
我正在尝试在 Ubuntu 20.04 上安装 Odoo 13,我按照不同的程序安装它,例如 this one,但我总是得到这个 psycopg2 错误(本段下方)当我到达安装 requirements.txt 的组件的步骤时,此错误仅发生在 python 虚拟环境中。
错误:
ERROR: Command errored out with exit status 1:
command: /opt/odoo/odoo-venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7jyb6cog/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7jyb6cog/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-7c07yrdu
cwd: /tmp/pip-install-7jyb6cog/psycopg2/
Complete output (40 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120002 -DHAVE_LO64=1 -I/opt/odoo/odoo-venv/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:27:
./psycopg/psycopg.h:35:10: fatal error: libpq-fe.h: No such file or directory
35 | #include <libpq-fe.h>
| ^~~~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psycopg2
我尝试手动安装不同版本的 psycopg2 但没有成功。
如果我不使用虚拟环境,没有错误,安装过程完全成功。
pip install psycopg2-binary
ubuntu 和 pip install psycopg2
windows
先安装Pillow
pip3 install pillow
比通过安装来安装 psycopg2
sudo apt install python3-dev libpq-dev
验证 pg_config 是否由 运行 安装
pg_config --version
如果不将其添加到路径
export PATH=/usr/lib/postgresql/X.Y/bin/:$PATH
在那之后
pip install psycopg2
接下来从 requirements.txt 中删除 psycopg2 和 pillow packagers
并重新运行
pip3 install -r requirements.txt
与 Python 3.8 一起安装 Odoo13 有点问题 很多软件包包括 psycopg2 、 Pillow 、 Python-ldap etc.It 有时我会花时间但我能够 运行 它python 3.8 在 20.04
我稍微更改了 requirment.txt 文件,然后观看我的 github link -
https://github.com/tanvirahmedkhan74/Installing-Odoo13-on-Ubuntu20.04-with-Python-3.8.git
用 github
上给定的文件替换 requirments.txt 文件
ubuntu 20 中的 odoo,带有连接自定义插件 repo 的选项
https://github.com/jerichoruz/odoo-instal-sh
pip install --upgrade wheel
我 运行 在从 req.txt 安装之前执行以上命令。在odoo14社区它解决了我的问题。
我正在尝试在 Ubuntu 20.04 上安装 Odoo 13,我按照不同的程序安装它,例如 this one,但我总是得到这个 psycopg2 错误(本段下方)当我到达安装 requirements.txt 的组件的步骤时,此错误仅发生在 python 虚拟环境中。
错误:
ERROR: Command errored out with exit status 1:
command: /opt/odoo/odoo-venv/bin/python3 -u -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-7jyb6cog/psycopg2/setup.py'"'"'; __file__='"'"'/tmp/pip-install-7jyb6cog/psycopg2/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-7c07yrdu
cwd: /tmp/pip-install-7jyb6cog/psycopg2/
Complete output (40 lines):
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-3.8
creating build/lib.linux-x86_64-3.8/psycopg2
copying lib/sql.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_ipaddress.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errorcodes.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_json.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/tz.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/__init__.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/pool.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/compat.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_range.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extensions.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/_lru_cache.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/errors.py -> build/lib.linux-x86_64-3.8/psycopg2
copying lib/extras.py -> build/lib.linux-x86_64-3.8/psycopg2
running build_ext
building 'psycopg2._psycopg' extension
creating build/temp.linux-x86_64-3.8
creating build/temp.linux-x86_64-3.8/psycopg
x86_64-linux-gnu-gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -g -fwrapv -O2 -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DPSYCOPG_VERSION=2.8.3 (dt dec pq3 ext lo64) -DPG_VERSION_NUM=120002 -DHAVE_LO64=1 -I/opt/odoo/odoo-venv/include -I/usr/include/python3.8 -I. -I/usr/include/postgresql -I/usr/include/postgresql/12/server -c psycopg/psycopgmodule.c -o build/temp.linux-x86_64-3.8/psycopg/psycopgmodule.o -Wdeclaration-after-statement
In file included from psycopg/psycopgmodule.c:27:
./psycopg/psycopg.h:35:10: fatal error: libpq-fe.h: No such file or directory
35 | #include <libpq-fe.h>
| ^~~~~~~~~~~~
compilation terminated.
It appears you are missing some prerequisite to build the package from source.
You may install a binary package by installing 'psycopg2-binary' from PyPI.
If you want to install psycopg2 from source, please install the packages
required for the build and try again.
For further information please check the 'doc/src/install.rst' file (also at
<http://initd.org/psycopg/docs/install.html>).
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for psycopg2
我尝试手动安装不同版本的 psycopg2 但没有成功。 如果我不使用虚拟环境,没有错误,安装过程完全成功。
pip install psycopg2-binary
ubuntu 和 pip install psycopg2
windows
先安装Pillow
pip3 install pillow
比通过安装来安装 psycopg2
sudo apt install python3-dev libpq-dev
验证 pg_config 是否由 运行 安装
pg_config --version
如果不将其添加到路径
export PATH=/usr/lib/postgresql/X.Y/bin/:$PATH
在那之后
pip install psycopg2
接下来从 requirements.txt 中删除 psycopg2 和 pillow packagers
并重新运行
pip3 install -r requirements.txt
与 Python 3.8 一起安装 Odoo13 有点问题 很多软件包包括 psycopg2 、 Pillow 、 Python-ldap etc.It 有时我会花时间但我能够 运行 它python 3.8 在 20.04 我稍微更改了 requirment.txt 文件,然后观看我的 github link -
https://github.com/tanvirahmedkhan74/Installing-Odoo13-on-Ubuntu20.04-with-Python-3.8.git
用 github
上给定的文件替换 requirments.txt 文件ubuntu 20 中的 odoo,带有连接自定义插件 repo 的选项 https://github.com/jerichoruz/odoo-instal-sh
pip install --upgrade wheel
我 运行 在从 req.txt 安装之前执行以上命令。在odoo14社区它解决了我的问题。