当我点击安装mysql-connector时我得到了这个
> Downloading/unpacking mysql-connector Downloading
> mysql-connector-2.2.3.tar.gz (12.0MB): 12.0MB downloaded Running
> setup.py (path:/tmp/pip_build_root/mysql-connector/setup.py) egg_info
> for package mysql-connector
>
> # Python architecture: 64-bit
> # Python ARCH_64BIT: True Installing collected packages: mysql-connector Running setup.py install for mysql-connector
> Not Installing MySQL C Extension
> Unable to find Protobuf include directory.
> # Python architecture: 64-bit
> # Python ARCH_64BIT: True
> Complete output from command /usr/bin/python -c "import setuptools,
> tokenize;__file__='/tmp/pip_build_root/mysql-connector/setup.py';exec(compile(getattr(tokenize,
> 'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
> 'exec'))" install --record /tmp/pip-9uM0JD-record/install-record.txt
> --single-version-externally-managed --compile:
> running install
>
> Not Installing MySQL C Extension
>
> running build
>
> running build_py
>
> creating build
>
> creating build/lib.linux-x86_64-2.7
>
> creating build/lib.linux-x86_64-2.7/mysql
>
> copying lib/mysql/__init__.py -> build/lib.linux-x86_64-2.7/mysql
>
> creating build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/network.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/cursor_cext.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/abstracts.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/protocol.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/custom_types.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/conversion.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/optionfiles.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/constants.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/errorcode.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/pooling.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/authentication.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/connection_cext.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/connection.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/charsets.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/__init__.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/version.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/cursor.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/dbapi.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/utils.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/catch23.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> copying lib/mysql/connector/errors.py ->
> build/lib.linux-x86_64-2.7/mysql/connector
>
> creating build/lib.linux-x86_64-2.7/mysql/connector/locales
>
> copying lib/mysql/connector/locales/__init__.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/locales
>
> creating build/lib.linux-x86_64-2.7/mysql/connector/locales/eng
>
> copying lib/mysql/connector/locales/eng/__init__.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/locales/eng
>
> copying lib/mysql/connector/locales/eng/client_error.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/locales/eng
>
> creating build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/base.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/introspection.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/compiler.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/client.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/operations.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/validation.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/__init__.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/features.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/schema.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> copying lib/mysql/connector/django/creation.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/django
>
> creating build/lib.linux-x86_64-2.7/mysql/connector/fabric
>
> copying lib/mysql/connector/fabric/connection.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/fabric
>
> copying lib/mysql/connector/fabric/balancing.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/fabric
>
> copying lib/mysql/connector/fabric/__init__.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/fabric
>
> copying lib/mysql/connector/fabric/caching.py ->
> build/lib.linux-x86_64-2.7/mysql/connector/fabric
>
> creating build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/protocol.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/result.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/crud.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/constants.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/statement.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/dbdoc.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/expr.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/errorcode.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/authentication.py ->
> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/compat.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/connection.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/charsets.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/__init__.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/protobuf.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> copying lib/mysqlx/errors.py -> build/lib.linux-x86_64-2.7/mysqlx
>
> creating build/lib.linux-x86_64-2.7/mysqlx/locales
>
> copying lib/mysqlx/locales/__init__.py ->
> build/lib.linux-x86_64-2.7/mysqlx/locales
>
> creating build/lib.linux-x86_64-2.7/mysqlx/locales/eng
>
> copying lib/mysqlx/locales/eng/__init__.py ->
> build/lib.linux-x86_64-2.7/mysqlx/locales/eng
>
> copying lib/mysqlx/locales/eng/client_error.py ->
> build/lib.linux-x86_64-2.7/mysqlx/locales/eng
>
> running build_ext
>
> Unable to find Protobuf include directory.
>
> # Python architecture: 64-bit
>
> # Python ARCH_64BIT: True
>
> ---------------------------------------- Cleaning up... Command /usr/bin/python -c "import setuptools,
> tokenize;__file__='/tmp/pip_build_root/mysql-connector/setup.py';exec(compile(getattr(tokenize,
> 'open', open)(__file__).read().replace('\r\n', '\n'), __file__,
> 'exec'))" install --record /tmp/pip-9uM0JD-record/install-record.txt
> --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/mysql-connector Storing debug log for failure
> in /home/liuchenhui/.pip/pip.log
和文件pip.log中的回溯
Removing temporary dir /tmp/pip_build_root...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/mysql-connector/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9uM0JD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/mysql-connector
Exception information:
Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main
status = self.run(options, args)
File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run
requirement_set.install(install_options, global_options, root=options.root_path)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install
requirement.install(install_options, global_options, *args, **kwargs)
File "/usr/lib/python2.7/dist-packages/pip/req.py", line 707, in install
cwd=self.source_dir, filter_stdout=self._filter_install, show_stdout=False)
File "/usr/lib/python2.7/dist-packages/pip/util.py", line 715, in call_subprocess
% (command_desc, proc.returncode, cwd))
InstallationError: Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/mysql-connector/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-9uM0JD-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/mysql-connector
所以我想知道如何解决这个问题 如果需要安装mysql c或其他? 我该怎么做? (这个描述够了吗?我可以展示吗?)
答案 0 :(得分:2)
我在安装python mysql-connector时遇到了几个不同的问题,并尝试了许多不同的解决方案,其中一些非常复杂。最后,这条简单的产品线对我来说最可靠:
pip install mysql-connector==2.1.4
答案 1 :(得分:0)
pip install mysql-connector-python-rf
来自官方文档中的用户评论。 :)
https://dev.mysql.com/doc/connector-python/en/connector-python-installation.html
这对我来说可以在W10和python 3.6
下安装它