Odoo 配置 连接Mysql

时间:2024-03-14 14:46:50

1:安装:

准备安装包:

pip3 install sqlalchemy

pip3 install pymssql

pip3 install mysqlclient

pip3 install pymysql

Odoo 配置 连接Mysql

 以上安装包:https://github.com/OCA/server-backend/tree/11.0 下可以下载到安装包

 

Odoo 配置 连接Mysql

pip3 install mysqlclient

Collecting mysqlclient

  Using cached https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz

    Complete output from command python setup.py egg_info:

    /bin/sh: 1: mysql_config: not found

    /bin/sh: 1: mariadb_config: not found

    /bin/sh: 1: mysql_config: not found

    Traceback (most recent call last):

      File "<string>", line 1, in <module>

      File "/tmp/pip-build-d00fnwi8/mysqlclient/setup.py", line 16, in <module>

        metadata, options = get_config()

      File "/tmp/pip-build-d00fnwi8/mysqlclient/setup_posix.py", line 61, in get_config

        libs = mysql_config("libs")

      File "/tmp/pip-build-d00fnwi8/mysqlclient/setup_posix.py", line 29, in mysql_config

        raise EnvironmentError("%s not found" % (_mysql_config_path,))

    OSError: mysql_config not found

解决:安装mysql相关

apt-get install  mysql-devel gcc gcc-devel python-devel .  

Docker 里面遇到问题:

apt-get install  mysql-devel gcc gcc-devel python-devel

Reading package lists... Done

Building dependency tree      

Reading state information... Done

E: Unable to locate package mysql-devel

E: Unable to locate package gcc-devel

E: Unable to locate package python-deve

解决:

apt-get update

sudo apt-get install libmysqlclient-dev python3-dev

E: Package 'libmysqlclient-dev' has no installation candidate

用下面解决

 sudo apt-get install default-libmysqlclient-dev

(https://blog.csdn.net/aafeiyang/article/details/100031981)

错误: error: invalid command 'bdist_wheel'

python3 -m pip install --upgrade pip

问题:

 error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

    apt-get install build-essential

     #include "Python.h"

     compilation terminated.

     error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

 解决:

sudo apt-get install python3 python-dev python3-dev      build-essential libssl-dev libffi-dev      libxml2-dev libxslt1-dev zlib1g-dev      python-pip (https://blog.csdn.net/qq_42642945/article/details/89182094)

最终安装:

sudo pip install mysqlclient (成功)

[email protected]:/# sudo pip install mysqlclient

Collecting mysqlclient

  Using cached https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz

Installing collected packages: mysqlclient

    Running setup.py install for mysqlclient ... done

Successfully installed mysqlclient-1.4.4