我正在按照 本教程 在 Mac 上安装 Odoo 15,但在运行
pip install -r requirements.txt
时遇到此错误:
Error compiling Cython file:
------------------------------------------------------------
...
cdef load_traceback
cdef Waiter
cdef wait
cdef iwait
cdef reraise
cpdef GEVENT_CONFIG
^
------------------------------------------------------------
src/gevent/_gevent_cgreenlet.pxd:181:6: Variables cannot be declared with 'cpdef'. Use 'cdef' instead.
我找到了几个解决 cython 错误的文档,但没有一个文档解决了我遇到的特定异常。
这为我解决了这个问题:
pip install pip setuptools wheel Cython==3.0.0a10
pip install gevent==20.9.0 --no-build-isolation
如果 psycopg2 出现问题,请运行以下命令:(您可以根据需要将 2.8.6 更改为 2.8.5)
export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib -L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include -I/opt/homebrew/opt/libpq/include"
pip3 install psycopg2==2.8.6
您可能还需要
brew install libpq --build-from-source brew install openssl
export LDFLAGS="-L/opt/homebrew/opt/[email protected]/lib -L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/[email protected]/include -I/opt/homebrew/opt/libpq/include"
如果reportlab出现安装错误,请尝试以下操作:
CFLAGS="-Wno-error=implicit-function-declaration" pip install reportlab==3.5.55
Odoo 15 目前似乎与 Python 3.10 不兼容。
您可以通过在需求文件中将 gevent/greenlet 升级到更新版本来消除该错误。我已经成功尝试了 gevent 21.12.0 和 greenlet 1.1.3,但是由于 Python 集合包的更改,您会遇到更多麻烦。 这里是有关gevent错误的问题的链接,以供参考。
暂时降级到 Python 3.9.0 以继续安装。
使用
gevent==21.12.0
解决了我的问题