pip install mysql-connector 安装出错

一、MySQL Connector/Python 2.2.3 的变化

之前 mysql 官方说MySQL Connector/Python 是纯python语言写的,但是呢! 这个问题在2.2.3中变天了;

以下是MySQL Connector/Python 2.2.3 是变更记录

Changes in MySQL Connector/Python 2.2.3 (2017-03-22)

Functionality Added or Changed

Bugs Fixed

Functionality Added or Changed

The pure Python implemention of Protobuf has been replaced by a C++ extension. This enables Connector/Python to support Python 2 and 3 as well as Protobuf 2 and 3. (Bug #25209469)

Connector/Python now supports IPv6 target hosts in X DevAPI connection strings.

 

二、它带来了什么问题

pip3.6 install mysql-connector # 安装不上mysql-connector 了 我的mac上没有这个依赖
Collecting mysql-connector
  Using cached mysql-connector-2.2.3.zip
Installing collected packages: mysql-connector
  Running setup.py install for mysql-connector ... error
    Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/bt/zvnw3lzj0j138lgvj21x728h0000gn/T/pip-build-5ozhefl4/mysql-connector/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/bt/zvnw3lzj0j138lgvj21x728h0000gn/T/pip-hx174vot-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.macosx-10.6-intel-3.6
    creating build/lib.macosx-10.6-intel-3.6/mysql
    copying lib/mysql/__init__.py -> build/lib.macosx-10.6-intel-3.6/mysql
    creating build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/__init__.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/abstracts.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/authentication.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/catch23.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/charsets.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/connection.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/connection_cext.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/constants.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/conversion.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/cursor.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/cursor_cext.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/custom_types.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/dbapi.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/errorcode.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/errors.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/network.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/optionfiles.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/pooling.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/protocol.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/utils.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    copying lib/mysql/connector/version.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector
    creating build/lib.macosx-10.6-intel-3.6/mysql/connector/locales
    copying lib/mysql/connector/locales/__init__.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/locales
    creating build/lib.macosx-10.6-intel-3.6/mysql/connector/locales/eng
    copying lib/mysql/connector/locales/eng/__init__.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/locales/eng
    copying lib/mysql/connector/locales/eng/client_error.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/locales/eng
    creating build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/__init__.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/base.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/client.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/compiler.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/creation.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/features.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/introspection.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/operations.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/schema.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    copying lib/mysql/connector/django/validation.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/django
    creating build/lib.macosx-10.6-intel-3.6/mysql/connector/fabric
    copying lib/mysql/connector/fabric/__init__.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/fabric
    copying lib/mysql/connector/fabric/balancing.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/fabric
    copying lib/mysql/connector/fabric/caching.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/fabric
    copying lib/mysql/connector/fabric/connection.py -> build/lib.macosx-10.6-intel-3.6/mysql/connector/fabric
    creating build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/__init__.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/authentication.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/charsets.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/compat.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/connection.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/constants.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/crud.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/dbdoc.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/errorcode.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/errors.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/expr.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/protobuf.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/protocol.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/result.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    copying lib/mysqlx/statement.py -> build/lib.macosx-10.6-intel-3.6/mysqlx
    creating build/lib.macosx-10.6-intel-3.6/mysqlx/locales
    copying lib/mysqlx/locales/__init__.py -> build/lib.macosx-10.6-intel-3.6/mysqlx/locales
    creating build/lib.macosx-10.6-intel-3.6/mysqlx/locales/eng
    copying lib/mysqlx/locales/eng/__init__.py -> build/lib.macosx-10.6-intel-3.6/mysqlx/locales/eng
    copying lib/mysqlx/locales/eng/client_error.py -> build/lib.macosx-10.6-intel-3.6/mysqlx/locales/eng
    running build_ext
    # Python architecture: 64-bit
    # Python ARCH_64BIT: True
    Unable to find Protobuf include directory.
    
    ----------------------------------------
Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 -u -c "import setuptools, tokenize;__file__='/private/var/folders/bt/zvnw3lzj0j138lgvj21x728h0000gn/T/pip-build-5ozhefl4/mysql-connector/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /var/folders/bt/zvnw3lzj0j138lgvj21x728h0000gn/T/pip-hx174vot-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/bt/zvnw3lzj0j138lgvj21x728h0000gn/T/pip-build-5ozhefl4/mysql-connector/

 

三、不行啦、我还是安装老版本的吧

pip3.6 install mysql-connector==2.1.4
Collecting mysql-connector==2.1.4
  Downloading mysql-connector-2.1.4.zip (355kB)
    100% |████████████████████████████████| 358kB 1.2MB/s 
Installing collected packages: mysql-connector
  Running setup.py install for mysql-connector ... done
Successfully installed mysql-connector-2.1.4

 

四、怎么样才能安装上最新版呢?

 

 

 

 

 

----

学习交流

pip install mysql-connector 安装出错_第1张图片

你可能感兴趣的:(pip install mysql-connector 安装出错)