pip3 install mysqlclient
安装时报错如下:Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ Collecting mysqlclient Downloading http://mirrors.aliyun.com/pypi/packages/3c/df/59cd2fa5e48d0804d213bdcb1acb4d08c403b61c7ff7ed4dd4a6a2deb3f7/mysqlclient-2.0.3.tar.gz (88 kB) |████████████████████████████████| 88 kB 2.2 MB/s ERROR: Command errored out with exit status 1: command: /home/huzing2524/.virtualenvs/dap_data/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-ri8xl694/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-ri8xl694/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-xzfd5ms1 cwd: /tmp/pip-install-ri8xl694/mysqlclient/ Complete output (15 lines): /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-install-ri8xl694/mysqlclient/setup.py", line 15, in <module> metadata, options = get_config() File "/tmp/pip-install-ri8xl694/mysqlclient/setup_posix.py", line 70, in get_config libs = mysql_config("libs") File "/tmp/pip-install-ri8xl694/mysqlclient/setup_posix.py", line 31, in mysql_config raise OSError("{} not found".format(_mysql_config_path)) OSError: mysql_config not found mysql_config --version mariadb_config --version mysql_config --libs ---------------------------------------- ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.
- 在终端中安装:
sudo apt install libmysqlclient-dev
- 重新安装mysqlclient即可:
Looking in indexes: http://mirrors.aliyun.com/pypi/simple/ Collecting mysqlclient Downloading http://mirrors.aliyun.com/pypi/packages/3c/df/59cd2fa5e48d0804d213bdcb1acb4d08c403b61c7ff7ed4dd4a6a2deb3f7/mysqlclient-2.0.3.tar.gz (88 kB) |████████████████████████████████| 88 kB 1.2 MB/s Building wheels for collected packages: mysqlclient Building wheel for mysqlclient (setup.py) ... done Created wheel for mysqlclient: filename=mysqlclient-2.0.3-cp38-cp38-linux_x86_64.whl size=109287 sha256=c5aeb57d06169379a95a8eaf20a89d6aab062ccec217d310dbfe2bd88b9ce515 Stored in directory: /home/huzing2524/.cache/pip/wheels/8e/ff/bf/c08c55e89d5891b74209ceeba17f7745cbe8ff04f2d787422e Successfully built mysqlclient Installing collected packages: mysqlclient Successfully installed mysqlclient-2.0.3
mysqlclient安装报错【OSError: mysql_config not found】
最新推荐文章于 2023-07-19 16:50:31 发布