python2.7 installation MySQLdb

Source: Internet
Author: User

Install MYSQLDB problems encountered.

Mac Version number: 10.11.6

Perform python2.7 setup.py build

Error:

urllib2.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:590)>

The error code is 590

The data found on the Internet is that Mac computers have many versions of Python, some of which are also caused by OS system.

Validation phase:

1. Directly using Python setup.py build, no problem, direct operation succeeded. Troubleshooting OS System Issues

2. The reason for the Internet search is the problem of SSL authentication, then try to solve

3. According to the error information to find the Urllib2 file, mine is under the/opt/local/library/frameworks/python.framework/versions/2.7/lib/python2.7 folder

4. Open urllib2.py, add the following code to the import SSL, and save

Ssl._create_default_https_context = Ssl._create_unverified_context

5. Try to re-execute the python2.7 setup.py build successfully.

When importing the SSL module, turn off the certificate verification.
One is global, one is not
Guess you're going to have to use the global
Import SSL

Ssl._create_default_https_context = Ssl._create_unverified_context

Reference: http://tieba.baidu.com/p/3596194843

python2.7 installation MySQLdb

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.