精华内容
下载资源
问答
  • Mac 安装 mysqlclient

    千次阅读 2020-12-07 13:19:27
    Mac 安装 mysqlclient pip3 install mysqlclient 安装 mysqlclient 时报错 OSError: mysql_config not found 将 mysql_config 添加到环境变量 将 /usr/local/mysql/bin 添加到环境变量 MySQL8.0

    Mac 安装 mysqlclient

    作者:Bright Xu

    pip3 install mysqlclient
    

    安装 mysqlclient 时报错OSError: mysql_config not found

    在这里插入图片描述

    其实将mysql_config 添加到环境变量就可以了

    我这里已经安装过 MySQL8.0 了, 如果你还没有安装,请自行安装

    MySQL8.0下载地址:

    mysql-8.0.12-macos10.13: https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.12-macos10.13-x86_64.dmg

    mysql-8.0.22-macos10.15: https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-8.0/mysql-8.0.22-macos10.15-x86_64.dmg

    MySQL默认安装位置 /usr/local/mysql

    mysql_config/usr/local/mysql/bin下面, 所以需要将/usr/local/mysql/bin添加到环境变量

    添加MySQL到环境变量

    添加MySQL到环境变量有两种方式, 一种是添加到系统环境变量(永久有效,需要权限), 一种是临时添加(关掉窗口之后就失效了)

    添加到系统环境变量

    sudo vim /etc/profile
    

    然后会提示输入密码, 然后在文件最后一行添加以下内容:

    PATH=$PATH:/usr/local/mysql/bin
    

    在这里插入图片描述

    确定没有错之后,然后应用环境变量的更改:

    source /etc/profile
    

    注意: 修改系统环境变量需要有权限, 而且一定要确保不能写错

    临时修改环境变量

    # 临时添加MySQL到环境变量
    export PATH=$PATH:/usr/local/mysql/bin
    

    安装mysqlclient

    安装之前先要确认是否添加了上面的环境变量

    # 查看MySQL版本
    mysql -V
    
    # 查看mysql_config版本
    mysql_config --version
    

    没错的话可以看到MySQL的版本,就说明添加环境变量成功了

    然后就可以安装mysqlclient

    pip3 install mysqlclient
    

    在这里插入图片描述

    这就说明mysqlclient安装成功了

    展开全文
  • mac 安装 mysqlclient

    2019-06-28 16:46:00
    mac 安装 mysqlclient pip3 install mysqlclient Collecting mysqlclient Using cached ...

    mac 安装 mysqlclient 

     

     

    pip3 install mysqlclient
    Collecting mysqlclient
      Using cached https://files.pythonhosted.org/packages/f4/f1/3bb6f64ca7a429729413e6556b7ba5976df06019a5245a43d36032f1061e/mysqlclient-1.4.2.post1.tar.gz
    Building wheels for collected packages: mysqlclient
      Building wheel for mysqlclient (setup.py) ... error
      ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/np/ctqs9s1n56v176z1v4j4_gsc0000gn/T/pip-install-v85uh_vq/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /private/var/folders/np/ctqs9s1n56v176z1v4j4_gsc0000gn/T/pip-wheel-otcfaj8y --python-tag cp36:
      ERROR: running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-x86_64-3.6
      creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb
      copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
      copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
      copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
      copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
      copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
      copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
      copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
      copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
      creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
      copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
      running build_ext
      building 'MySQLdb._mysql' extension
      creating build/temp.macosx-10.9-x86_64-3.6
      creating build/temp.macosx-10.9-x86_64-3.6/MySQLdb
      gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/local/Cellar/mysql/8.0.16/include/mysql -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.6/MySQLdb/_mysql.o
      gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql/8.0.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.6/MySQLdb/_mysql.cpython-36m-darwin.so
      ld: library not found for -lssl
      clang: error: linker command failed with exit code 1 (use -v to see invocation)
      error: command 'gcc' failed with exit status 1
      ----------------------------------------
      ERROR: Failed building wheel for mysqlclient
      Running setup.py clean for mysqlclient
    Failed to build mysqlclient
    Installing collected packages: mysqlclient
      Running setup.py install for mysqlclient ... error
        ERROR: Complete output from command /Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/np/ctqs9s1n56v176z1v4j4_gsc0000gn/T/pip-install-v85uh_vq/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/np/ctqs9s1n56v176z1v4j4_gsc0000gn/T/pip-record-nnm4wq71/install-record.txt --single-version-externally-managed --compile:
        ERROR: running install
        running build
        running build_py
        creating build
        creating build/lib.macosx-10.9-x86_64-3.6
        creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb
        copying MySQLdb/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
        copying MySQLdb/_exceptions.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
        copying MySQLdb/compat.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
        copying MySQLdb/connections.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
        copying MySQLdb/converters.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
        copying MySQLdb/cursors.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
        copying MySQLdb/release.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
        copying MySQLdb/times.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb
        creating build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
        copying MySQLdb/constants/__init__.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
        copying MySQLdb/constants/CLIENT.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
        copying MySQLdb/constants/CR.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
        copying MySQLdb/constants/ER.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
        copying MySQLdb/constants/FIELD_TYPE.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
        copying MySQLdb/constants/FLAG.py -> build/lib.macosx-10.9-x86_64-3.6/MySQLdb/constants
        running build_ext
        building 'MySQLdb._mysql' extension
        creating build/temp.macosx-10.9-x86_64-3.6
        creating build/temp.macosx-10.9-x86_64-3.6/MySQLdb
        gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -g -Dversion_info=(1,4,2,'post',1) -D__version__=1.4.2.post1 -I/usr/local/Cellar/mysql/8.0.16/include/mysql -I/Library/Frameworks/Python.framework/Versions/3.6/include/python3.6m -c MySQLdb/_mysql.c -o build/temp.macosx-10.9-x86_64-3.6/MySQLdb/_mysql.o
        gcc -bundle -undefined dynamic_lookup -arch x86_64 -g build/temp.macosx-10.9-x86_64-3.6/MySQLdb/_mysql.o -L/usr/local/Cellar/mysql/8.0.16/lib -lmysqlclient -lssl -lcrypto -o build/lib.macosx-10.9-x86_64-3.6/MySQLdb/_mysql.cpython-36m-darwin.so
        ld: library not found for -lssl
        clang: error: linker command failed with exit code 1 (use -v to see invocation)
        error: command 'gcc' failed with exit status 1
        ----------------------------------------
    ERROR: Command "/Library/Frameworks/Python.framework/Versions/3.6/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/private/var/folders/np/ctqs9s1n56v176z1v4j4_gsc0000gn/T/pip-install-v85uh_vq/mysqlclient/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record /private/var/folders/np/ctqs9s1n56v176z1v4j4_gsc0000gn/T/pip-record-nnm4wq71/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/fol
    
    
    LDFLAGS=-L/usr/local/opt/openssl/lib pip3 install mysqlclient

     

    转载于:https://www.cnblogs.com/morgana/p/11103589.html

    展开全文
  • MAC 安装mysqlclient

    2020-09-27 11:05:41
    MAC 安装mysqlclient 1-使用brew安装mysql brew install mysql-connector-c 2-修改环境变量文件 echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> /Users/yyl/.bash_profile export LDFLAGS...

    MAC 安装mysqlclient

    1-使用brew安装mysql

    brew install mysql-connector-c
    
    

    在这里插入图片描述

    2-修改环境变量文件

    echo 'export PATH="/usr/local/opt/mysql-client/bin:$PATH"' >> /Users/yyl/.bash_profile
    echo 'export LDFLAGS="-L/usr/local/opt/mysql-client/lib"' >> /Users/yyl/.bash_profile
    echo 'export CPPFLAGS="-I/usr/local/opt/mysql-client/include"' >> /Users/yyl/.bash_profile
    # 不要忘记source一下
    source /Users/yyl/.bash_profile
    

    3-安装mysqlclient

    pip install mysqlclient
    
    展开全文
  • 主要介绍了Mac 安装 mysqlclient过程解析,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
  • mac安装mysqlclient

    千次阅读 2018-07-18 16:31:07
    方法一 brew install mysql --client-only --universal 方法二 https://dev.mysql.com/downloads/shell/
    方法一 
    brew install mysql --client-only --universal

    方法二

    https://dev.mysql.com/downloads/shell/

    展开全文
  • mac系统安装mysqlclient时,会报错OSError: mysql_config not found 解决办法 在项目路径下输入以下内容 PATH="$PATH":/usr/local/mysql/bin/ mysql_config 最后输入pip3 install mysqlclient即可成功安装 ...
  • Python Mac安装 mysqlclient 包报错“error: command ‘clang’ failed with exit status 1”解决办法 今天在 Mac安装 mysqlclient 包总是报错,面向度娘解决问题找了好久终于解决,所以把解决的方法记录下来 ...
  • 最近学Python,需要用到mysqlclient,周边的人都使用的是Windows,大家安装的都挺轻松的,结果轮到我的时候,无论如何也下不下来,不停报错,最终在结合了多个相关文档,最终找到了解决方法: 首先是安装mysqlclient的方法: ...
  • pip install mysqlclient 但是很多情况下上述的命令会报错,解决办法度娘上可以找到,解决办法大致一致 首先叫你安装 mysql-connector-c,然后在使用 pip 进行安装,如果还有问题就打开 /usr/local/bin/mysql_...
  • 安装mysql8(官网下载), 系统自带的python3.7, brew 安装mysql-client、openssl, 添加path # mysql export PATH="$PATH":/usr/local/mysql/bin export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/:$DYLD_...
  • 解压后进入mysqlclient中setup.py 所在的目录 然后执行下面语句 python setup.py clean python setup.py build python setup.py install 发现报错: 根据报错信息找到这个报错的文件 mysqlclient...
  • sudo pip3 install mysqlclient 报错: EnvironmentError: mysql_config not found 解决: brew install mysql-connector-c sudo vim /usr/local/bin/mysql_config 把以下内容修改 修改前: #Create options libs="-...
  • mac下python虚拟环境的配置和本地配置的冲突解决记录.
  • 这是一个来自mysql官方的bug,...shuais-MBP:wxapp dandyzhang$ pipenv install mysqlclient Installing mysqlclient... Collecting mysqlclient Using cached https://files.pythonhosted.org/packages/ec/f...
  • 由于本人使用的mac+python3.5安装MySQLdb报错网上搜索后发现mac版本python3以上安装 brew install mysqlclientmysqlclient(https://github.com/PyMySQL/mysqlclient-python)github地址PrerequisitesYou may need ...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 1,061
精华内容 424
关键字:

mac安装mysqlclient

mysql 订阅