我正在尝试在我的代码中导入一个称为模式的python模块。但是,当我运行时:
pip install pattern

我得到以下输出:

Collecting patternUsing cachedhttps://files.pythonhosted.org/packages/1e/07/b0e61b6c818ed4b6145fe01d1c341223aa6cfbc3928538ad1f2b890924a3/Pattern-3.6.0.tar.gzCollecting future (from pattern) Using cached https://files.pythonhosted.org/packages/90/52/e20466b85000a181e1e144fd8305caf2cf475e2f9674e797b222f8105f5f/future-0.17.1.tar.gzCollecting backports.csv (from pattern) Using cached https://files.pythonhosted.org/packages/8e/26/a6bd68f13e0f38fbb643d6e497fc3462be83a0b6c4d43425c78bb51a7291/backports.csv-1.0.7-py2.py3-none-any.whlCollecting mysqlclient (from pattern) Using cached https://files.pythonhosted.org/packages/4d/38/c5f8bac9c50f3042c8f05615f84206f77f03db79781db841898fde1bb284/mysqlclient-1.4.4.tar.gz ERROR: Command errored out with exit status 1: command: /usr/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-4Proy9/mysqlclient/setup.py'"'"'; __file__='"'"'/tmp/pip-install-4Proy9/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 pip-egg-info cwd: /tmp/pip-install-4Proy9/mysqlclient/ Complete output (12 lines): sh: 1: mysql_config: not found sh: 1: mariadb_config: not found sh: 1: mysql_config: not found Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-install-4Proy9/mysqlclient/setup.py", line 16, in <module> metadata, options = get_config() File "setup_posix.py", line 61, in get_config libs = mysql_config("libs") File "setup_posix.py", line 29, in mysql_config raise EnvironmentError("%s not found" % (_mysql_config_path,)) EnvironmentError: mysql_config not found ----------------------------------------ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我已经安装了mysql,也尝试安装mysqlclient。我不确定该怎么办!

最佳答案

要构建/安装mysqlclient,您将需要mysqlclient库和头文件。为了确定它们的位置,mysqlclient需要调用mysql_config脚本(未找到)。

您需要安装mysql客户端库。 (例如libmysqlclient-dev)。还要确保路径中有mysql_config脚本。

关于python - 无法在Windows ubuntu上的python中安装模式模块,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/57839760/

10-11 03:22