美文网首页
python3下安装mysqlclient各种报错 raise

python3下安装mysqlclient各种报错 raise

作者: 木头左 | 来源:发表于2024-04-22 18:47 被阅读0次

    linux下载地址:https://files.pythonhosted.org/packages/a5/e1/e5f2b231c05dc51d9d87fa5066f90d1405345c54b14b0b11a1c859020f21/mysqlclient-2.0.1.tar.gz#sha256=fb2f75aea14722390d2d8ddf384ad99da708c707a96656210a7be8af20a2c5e5

    在服务器执行

    pip install mysqlclient-2.0.1.tar.gz```
    
    
    报错
    
    Processing ./mysqlclient-2.0.1.tar.gz     Complete output from command python setup.py egg_info:     /bin/sh: mysql_config: command not found     /bin/sh: mariadb_config: command not found     /bin/sh: mysql_config: command not found     Traceback (most recent call last):       File "<string>", line 1, in <module>       File "/tmp/pip-8svitbbv-build/setup.py", line 15, in <module>         metadata, options = get_config()       File "/tmp/pip-8svitbbv-build/setup_posix.py", line 65, in get_config         libs = mysql_config("libs")       File "/tmp/pip-8svitbbv-build/setup_posix.py", line 31, in mysql_config         raise OSError("{} not found".format(_mysql_config_path))     OSError: mysql_config not found 执行如下
    
    ```bash
    yum install mysql-devel gcc gcc-devel python-devel```
    
    
       又报错:
    
    MySQLdb/_mysql.c:46:20: fatal error: Python.h: No such file or directory      #include "Python.h"                         ^     compilation terminated.     error: command 'gcc' failed with exit status 1
    
    还是官网最靠谱,可能以上都不用装
    
    ```bash
    $ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential # Debian / Ubuntu
    % sudo yum install python3-devel mysql-devel # Red Hat / CentOS```
    
    
    在服务器执行
    
    ```bash
    pip install mysqlclient-2.0.1.tar.gz```
    
    
    Processing ./mysqlclient-2.0.1.tar.gz Installing collected packages: mysqlclient   Running setup.py install for mysqlclient ... done Successfully installed mysqlclient-2.0.1  
    
    

    相关文章

      网友评论

          本文标题:python3下安装mysqlclient各种报错 raise

          本文链接:https://www.haomeiwen.com/subject/mhkixjtx.html