Mac installation Python mysqlclient problems encountered and how to solve

Source: Internet
Author: User

Install Mysqlclient on Mac encountered some problems, find data many people have encountered the same problem. Through the data and experiments, succeeded. Here is a record of the hope to help people who have met the same problem.

I use Python3, the installation steps are as follows:

Install mysql-connector-Install mysqlclient

An error occurred while executing PIP3 install Mysqlclient:

? /usr/local/cellar/mysql-connector-c/6.1. One/bin &GT;PIP3Installmysqlclientcollecting mysqlclient Using Cached Mysqlclient-1.3. A.Tar. GZ complete output from command python setup.py egg_info:traceback (most recent call Last): File"<string>", line1,inch<module>File"/private/var/folders/2w/56bgkvqd1xldl56fx_gx_fg00000gn/t/pip-build-f9admsgv/mysqlclient/setup.py", line -,inch<module>metadata, Options=get_config () File"/private/var/folders/2w/56bgkvqd1xldl56fx_gx_fg00000gn/t/pip-build-f9admsgv/mysqlclient/setup_posix.py ", line Wu,inchGet_config Libraries= [Dequote (i[2:]) forIinchLibsifI.startswith ('- L')] File"/private/var/folders/2w/56bgkvqd1xldl56fx_gx_fg00000gn/t/pip-build-f9admsgv/mysqlclient/setup_posix.py ", line Wu,inch<listcomp>Libraries= [Dequote (i[2:]) forIinchLibsifI.startswith ('- L')] File"/private/var/folders/2w/56bgkvqd1xldl56fx_gx_fg00000gn/t/pip-build-f9admsgv/mysqlclient/setup_posix.py ", line A,inchDequoteifs[0]inch "\ "'"and s[0] = = s[-1]: indexerror:stringindex out of range----------------------------------------

Solution: Mysql_config

Execute: Vim mysql_config, search for Libs, or 114 lines, replace with 115 lines

 the # Create Options 113 libs="-l$pkglibdir"#libs = "$libs-l"   # #源代码  libs= "$libs-lmysqlclient-lssl-lcrypto"  # #修改成这样

Execute PIP3 install mysqlclient again and succeed. As shown below:

? /usr/local/cellar/mysql-connector-c/6.1. One/bin &GT;PIP3Installmysqlclientcollecting mysqlclient Using Cached Mysqlclient-1.3. A.Tar. Gzbuilding Wheels forcollected packages:mysqlclient Running setup.py bdist_wheel forMysqlclient ... DoneStoredinchDirectory:/users/kk/library/caches/pip/wheels/DF/bb/ -/bf7c315cbe163515db1c846e4ffa5557dd785c82e82f3492e8successfully built mysqlclientinstalling collected packages: Mysqlclientsuccessfully installed Mysqlclient-1.3. A

Mac installation Python mysqlclient problems encountered and how to solve

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.