在 Mac 上安装 Odoo 会引发 gevent 错误

HuL*_*iCa 2 python cython odoo

我按照本教程在 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.
Run Code Online (Sandbox Code Playgroud)

我发现了几个解决 cython 错误的文档,但没有一个文档解决我遇到的特定异常。

小智 7

这为我解决了这个问题:

pip install pip setuptools wheel Cython==3.0.0a10
pip install gevent==20.9.0 --no-build-isolation
Run Code Online (Sandbox Code Playgroud)

如果 psycopg2 出现问题,请运行以下命令:(您可以根据需要将 2.8.6 更改为 2.8.5)

export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libpq/include"

pip3 install psycopg2==2.8.6
Run Code Online (Sandbox Code Playgroud)

你可能还需要

brew install libpq --build-from-source                                                                                      brew install openssl

export LDFLAGS="-L/opt/homebrew/opt/openssl@1.1/lib -L/opt/homebrew/opt/libpq/lib"
export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.1/include -I/opt/homebrew/opt/libpq/include"
Run Code Online (Sandbox Code Playgroud)

如果 reportlab 出现安装错误,请尝试以下操作:

CFLAGS="-Wno-error=implicit-function-declaration" pip install reportlab==3.5.55  
Run Code Online (Sandbox Code Playgroud)