Python 无法安装模式包(OS Bash终端)

Python 无法安装模式包(OS Bash终端),python,macos,pip,Python,Macos,Pip,我无法安装模式包。请提供帮助 lucy$ pip3 install pattern Collecting pattern Using cached https://files.pythonhosted.org/packages/1e/07/b0e61b6c818ed4b6145fe01d1c341223aa6cfbc3928538ad1f2b890924a3/Pattern-3.6.0.tar.gz Collecting future Using cached https://files

我无法安装模式包。请提供帮助

lucy$ pip3 install pattern
Collecting pattern
  Using cached https://files.pythonhosted.org/packages/1e/07/b0e61b6c818ed4b6145fe01d1c341223aa6cfbc3928538ad1f2b890924a3/Pattern-3.6.0.tar.gz
Collecting future
  Using cached https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz
Collecting backports.csv
  Using cached https://files.pythonhosted.org/packages/8e/26/a6bd68f13e0f38fbb643d6e497fc3462be83a0b6c4d43425c78bb51a7291/backports.csv-1.0.7-py2.py3-none-any.whl
Collecting mysqlclient
  Using cached https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz
    ERROR: Command errored out with exit status 1:
     command: /Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/setup.py'"'"'; __file__='"'"'/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/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 /private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/pip-egg-info
         cwd: /private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/
    Complete output (12 lines):
    /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 "/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/setup.py", line 16, in <module>
        metadata, options = get_config()
      File "/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/setup_posix.py", line 61, in get_config
        libs = mysql_config("libs")
      File "/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/setup_posix.py", line 29, in mysql_config
        raise EnvironmentError("%s not found" % (_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.
(base) n20286z185l10:assortedcodes lucy$ 
lucy$pip3安装模式 收集模式 使用缓存https://files.pythonhosted.org/packages/1e/07/b0e61b6c818ed4b6145fe01d1c341223aa6cfbc3928538ad1f2b890924a3/Pattern-3.6.0.tar.gz 收集未来 使用缓存https://files.pythonhosted.org/packages/45/0b/38b06fd9b92dc2b68d58b75f900e97884c45bedd2ff83203d933cf5851c9/future-0.18.2.tar.gz 正在收集backport.csv 使用缓存https://files.pythonhosted.org/packages/8e/26/a6bd68f13e0f38fbb643d6e497fc3462be83a0b6c4d43425c78bb51a7291/backports.csv-1.0.7-py2.py3-none-any.whl 收集mysqlclient 使用缓存https://files.pythonhosted.org/packages/d0/97/7326248ac8d5049968bf4ec708a5d3d4806e412a42e74160d7f266a3e03a/mysqlclient-1.4.6.tar.gz 错误:命令出错,退出状态为1: 命令:/Library/Frameworks/Python.framework/Versions/3.7/bin/python3.7-c'import sys、setuptools、tokenize;sys.argv[0]=“private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/setup.py”__文件“'/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/setup.py'”;f=getattr(标记化,“'open'”,open)(\uuuuu文件);code=f.read().replace(“\r\n”“”、“\n”“”);f、 close();exec(编译(代码,“‘exec’”)‘蛋’信息——蛋库/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/pip蛋信息 cwd:/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/ 完整输出(12行): /bin/sh:mysql\u config:未找到命令 /bin/sh:mariadb\u配置:未找到命令 /bin/sh:mysql\u config:未找到命令 回溯(最近一次呼叫最后一次): 文件“”,第1行,在 文件“/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/setup.py”,第16行,在 元数据,options=get_config() 文件“/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/setup_posix.py”,第61行,在get_config中 libs=mysql_config(“libs”) 文件“/private/var/folders/dg/3dc4wnvn2ll0bz4p781nw1jc0000gn/T/pip-install-v1dttx0k/mysqlclient/setup_posix.py”,第29行,在mysql_配置中 raise环境错误(“%s未找到”)(\u mysql\u配置\u路径,) 操作错误:未找到mysql\u配置 ---------------------------------------- 错误:命令出错,退出状态为1:python setup.py egg_info检查日志以获得完整的命令输出。 (基本)n20286z185l10:分类代码lucy$
模式支持Python 2.7和Python 3.6。 请参考。 这使pattern.en能够在python 3.6中工作:

git clone -b development https://github.com/clips/pattern
cd pattern
sudo python3.6 setup.py install
import nltk
import ssl 

try:
  _create_unverified_https_context = ssl._create_unverified_context
except AttributeError:
  pass
else:
  ssl._create_default_https_context = _create_unverified_https_context

nltk.download('wordnet_ic')
我在mac(10.11.6)上安装时出现了一些SSL错误,这些错误通过在python(3.6)中运行此代码得到修复:

显然,有一种更好的方法来处理类似以下fwiw的ssl内容:

健全性检查:

user@USDR00253 ~> python3.6
Python 3.6.4 (v3.6.4:d48ecebad5, Dec 18 2017, 21:07:28)
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
>>> from pattern.en import conjugate, lemma, lexeme, parse
>>>
>>> print(parse('ridden', relations=True, lemmata=True))
ridden/VBN/B-VP/O/O/ride
>>>
pattern.en终于在python 3中运行了