mysqlclient==1.4.2.post1 安装失败

来源:4-1 Cookiecutter安装和使用(附文档)

慕姐7027134

2020-12-02

安装MySQL步骤
1上传到linux
mysql-community-client-8.0.11-1.el7.x86_64.rpm
mysql-community-common-8.0.11-1.el7.x86_64.rpm
mysql-community-devel-8.0.11-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.11-1.el7.x86_64.rpm
mysql-community-libs-8.0.11-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.11-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-8.0.11-1.el7.x86_64.rpm
mysql-community-server-8.0.11-1.el7.x86_64.rpm
mysql-community-server-minimal-8.0.11-1.el7.x86_64.rpm
mysql-community-test-8.0.11-1.el7.x86_64.rpm
2

 rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm 
 rpm -ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm 
 rpm -ivh mysql-community-client-8.0.11-1.el7.x86_64.rpm 
 rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm 
chmod -R 777 /var/lib/mysql/
mysqld --initialize
chmod -R 777 /var/lib/mysql/*
  • 启动MySQL
service mysqld start
  • 查看初始密码

    grep 'temporary password' /var/log/mysqld.log
    
  • 登陆数据库之后,修改默认密码

    alter user user() identified by "abc123456"; 
    

**安装成功mysql
mysql -u root -p ****可以登录
执行pip3 install mysqlclient==1.4.2.post1
报错如下:
[root@localhost yum.repos.d]# pip3 install mysqlclient
Looking in indexes: https://pypi.tuna.tsinghua.edu.cn/simple
Collecting mysqlclient
Downloading https://pypi.tuna.tsinghua.edu.cn/packages/a5/e1/e5f2b231c05dc51d9d87fa5066f90d1405345c54b14b0b11a1c859020f21/mysqlclient-2.0.1.tar.gz (87 kB)
|████████████████████████████████| 87 kB 519 kB/s
ERROR: Command errored out with exit status 1:
command: /usr/local/python3/bin/python3.7 -c ‘import sys, setuptools, tokenize; sys.argv[0] = ‘"’"’/tmp/pip-install-7dyefow_/mysqlclient/setup.py’"’"’; file=’"’"’/tmp/pip-install-7dyefow_/mysqlclient/setup.py’"’"’;f=getattr(tokenize, ‘"’"‘open’"’"’, open)(file);code=f.read().replace(’"’"’\r\n’"’"’, ‘"’"’\n’"’"’);f.close();exec(compile(code, file, ‘"’"‘exec’"’"’))’ egg_info --egg-base /tmp/pip-pip-egg-info-ck8ysc5u
cwd: /tmp/pip-install-7dyefow_/mysqlclient/
Complete output (12 lines):
/bin/sh: mysql_config: 未找到命令
/bin/sh: mariadb_config: 未找到命令
/bin/sh: mysql_config: 未找到命令
Traceback (most recent call last):
File “”, line 1, in
File “/tmp/pip-install-7dyefow_/mysqlclient/setup.py”, line 15, in
metadata, options = get_config()
File “/tmp/pip-install-7dyefow_/mysqlclient/setup_posix.py”, line 65, in get_config
libs = mysql_config(“libs”)
File “/tmp/pip-install-7dyefow_/mysqlclient/setup_posix.py”, line 31, in mysql_config
raise OSError("{} not found".format(_mysql_config_path))
OSError: mysql_config not found
----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
[root@localhost yum.repos.d]#

写回答

1回答

Jack

2020-12-05

您好,可能是系统上缺少需要的依赖mysql-devel 

yum -y install python3-devel zlib-devel mysql-devel libffi-devel bzip2-devel openssl-devel java wget gcc

其它的也都装上吧,有的可能已经有了,有的是后面需要用到的。

0
0

Django高级实战 开发企业级问答网站

融合Django高级用法/算法/设计模式/TestCase测试/云计算打造项目

900 学习 · 756 问题

查看课程