zoukankan      html  css  js  c++  java
  • pip安装包时遇到的Bug

    背景

      今天打包人生中的第一个package到PyPi,在linux上执行pip3 install mysqltools-python安装一点问题都没有,打脸的是在自己的MAC上

      居然安装不上

    pip3 install mysqltools-python
    Collecting mysqltools-python
      Downloading https://files.pythonhosted.org/packages/46/da/de9495da7bf0ee9225a1f1988ab5cb4e8573388338df1e55d8b5272c413a/mysqltools-python-2.18.09.01.tar.gz
    Collecting mysql-connector-python>=8.0.12 (from mysqltools-python)
      Downloading https://files.pythonhosted.org/packages/23/ca/9bb3e8c2ae661f7f5ca3425cbcb82f7e676276d2d07d17812c4e1a83fa0b/mysql_connector_python-8.0.12-cp36-cp36m-macosx_10_12_x86_64.whl (3.5MB)
        100% |████████████████████████████████| 3.5MB 435kB/s 
    Requirement already satisfied: protobuf>=3.0.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from mysql-connector-python>=8.0.12->mysqltools-python) (3.5.2)
    Requirement already satisfied: six>=1.9 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from protobuf>=3.0.0->mysql-connector-python>=8.0.12->mysqltools-python) (1.11.0)
    Requirement already satisfied: setuptools in ./Library/Python/3.6/lib/python/site-packages (from protobuf>=3.0.0->mysql-connector-python>=8.0.12->mysqltools-python) (40.2.0)
    Building wheels for collected packages: mysqltools-python
      Running setup.py bdist_wheel for mysqltools-python ... done
      Stored in directory: /Users/jianglexing/Library/Caches/pip/wheels/19/78/6a/3f6c6442c7f3608c70d4d3f35e43146712b49bcdfa33485be8
    Successfully built mysqltools-python
    Installing collected packages: mysql-connector-python, mysqltools-python
      Found existing installation: mysql-connector-python 2.1.5
    Cannot uninstall 'mysql-connector-python'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.

      看报错的信息提示说“Cannot unintall mysql-connector-python” 由于mysqltools-python依赖于mysql-connector-python-8.0.12

      所以pip会先把我机器上低版本的“mysql-connector-python”卸载掉,然后安装“mysql-connector-python-8.0.12”以上版本的;

      现在的问题就出在了卸载“mysql-connector-python”上。

    第一回合 手工卸载mysql-connector-python

    pip3 uninstall mysql-connector-python
    Cannot uninstall 'mysql-connector-python'. It is a distutils installed project and thus we cannot accurately determine which files belong to it which would lead to only a partial uninstall.
    You are using pip version 10.0.1, however version 18.0 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.

      看来还是太年轻了,手工卸载不了!

    第二回合 google

      google了一下之后发现并不是只有我一个人遇到了这个问题,这个是pip-10.0.1版本的一个bug,这样解决方案就来了,我只要把pip3的版本

      降下去就行了

    pip --version
    pip 10.0.1 from /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pip (python 3.6)
    
    pip install --upgrade --force-reinstall pip==9.0.3
    Collecting pip==9.0.3
      Downloading https://files.pythonhosted.org/packages/ac/95/a05b56bb975efa78d3557efa36acaf9cf5d2fd0ee0062060493687432e03/pip-9.0.3-py2.py3-none-any.whl (1.4MB)
        100% |████████████████████████████████| 1.4MB 3.2MB/s 
    Installing collected packages: pip
      Found existing installation: pip 10.0.1
        Uninstalling pip-10.0.1:
          Successfully uninstalled pip-10.0.1
    Successfully installed pip-9.0.3

    第三回合 安装mysqltools-python

    pip3 install mysqltools-python
    Collecting mysqltools-python
      Downloading https://files.pythonhosted.org/packages/46/da/de9495da7bf0ee9225a1f1988ab5cb4e8573388338df1e55d8b5272c413a/mysqltools-python-2.18.09.01.tar.gz
    Collecting mysql-connector-python>=8.0.12 (from mysqltools-python)
      Cache entry deserialization failed, entry ignored
      Cache entry deserialization failed, entry ignored
      Downloading https://files.pythonhosted.org/packages/23/ca/9bb3e8c2ae661f7f5ca3425cbcb82f7e676276d2d07d17812c4e1a83fa0b/mysql_connector_python-8.0.12-cp36-cp36m-macosx_10_12_x86_64.whl (3.5MB)
        100% |████████████████████████████████| 3.5MB 230kB/s 
    Requirement already satisfied: protobuf>=3.0.0 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from mysql-connector-python>=8.0.12->mysqltools-python)
    Requirement already satisfied: setuptools in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from protobuf>=3.0.0->mysql-connector-python>=8.0.12->mysqltools-python)
    Requirement already satisfied: six>=1.9 in /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages (from protobuf>=3.0.0->mysql-connector-python>=8.0.12->mysqltools-python)
    Building wheels for collected packages: mysqltools-python
      Running setup.py bdist_wheel for mysqltools-python ... done
      Stored in directory: /var/root/Library/Caches/pip/wheels/19/78/6a/3f6c6442c7f3608c70d4d3f35e43146712b49bcdfa33485be8
    Successfully built mysqltools-python
    Installing collected packages: mysql-connector-python, mysqltools-python
    Successfully installed mysql-connector-python-8.0.12 mysqltools-python-2.18.9.1
    You are using pip version 9.0.3, however version 18.0 is available.
    You should consider upgrading via the 'pip install --upgrade pip' command.
    sh-3.2# 

    学习交流

     -----------------------------http://www.sqlpy.com-------------------------------------------------

     -----------------------------http://www.sqlpy.com-------------------------------------------------

    ---

  • 相关阅读:
    Example of Formalising a Grammar for use with Lex & Yacc
    TCL脚本语言基础介绍
    linux环境下的c++编程
    如何利用FPGA进行时序分析设计
    可移植的配置visual studio工程第三方库
    [转]windows10 1703 鼠标右键打开命令提示符cmd
    重载和const形参的学习心得
    华为codecraft2018总结
    【转】C/C++使用心得:enum与int的相互转换
    C++学习笔记1-使用数组进行vector初始化
  • 原文地址:https://www.cnblogs.com/JiangLe/p/9592689.html
Copyright © 2011-2022 走看看