简体   繁体   English

在Mac上安装MySQL-Python时出错

[英]Error installing MySQL-Python on Mac

I tried to install the MySQL-Python library for development with Django, but always show any errors in the different ways: 我尝试安装MySQL-Python库以进行Django开发,但始终以不同的方式显示任何错误:

With PIP: 使用PIP:

rigo:~ rigobcastro$ sudo pip install MySQL-Python
Downloading/unpacking MySQL-Python
  Could not fetch URL https://pypi.python.org/simple/MySQL-Python/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:503: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
  Will skip URL https://pypi.python.org/simple/MySQL-Python/ when looking for download links for MySQL-Python
  Could not fetch URL https://pypi.python.org/simple/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:503: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
  Will skip URL https://pypi.python.org/simple/ when looking for download links for MySQL-Python
  Cannot fetch index base URL https://pypi.python.org/simple/
  Could not fetch URL https://pypi.python.org/simple/MySQL-Python/: There was a problem confirming the ssl certificate: <urlopen error [Errno 1] _ssl.c:503: error:0D0890A1:asn1 encoding routines:ASN1_verify:unknown message digest algorithm>
  Will skip URL https://pypi.python.org/simple/MySQL-Python/ when looking for download links for MySQL-Python
  Could not find any downloads that satisfy the requirement MySQL-Python
No distributions at all found for MySQL-Python
Storing complete log in /Users/rigobcastro/.pip/pip.log

With easy_install: 使用easy_install:

rigo:~ rigobcastro$ sudo easy_install MySQL-Python
Searching for MySQL-Python
Reading http://pypi.python.org/simple/MySQL-Python/
Reading http://sourceforge.net/projects/mysql-python
Reading https://github.com/farcepest/MySQLdb1
Best match: MySQL-python 1.2.4
Downloading http://pypi.python.org/packages/source/M/MySQL-python/MySQL-python-1.2.4.zip#md5=ddf2386daf10a97af115ffad2ed4a9a0
Processing MySQL-python-1.2.4.zip
Running MySQL-python-1.2.4/setup.py -q bdist_egg --dist-dir /tmp/easy_install-mx6sxJ/MySQL-python-1.2.4/egg-dist-tmp-XMcHdk
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.28.tar.gz
Extracting in /tmp/easy_install-mx6sxJ/MySQL-python-1.2.4/temp/tmp9GMCmz
Now working in /tmp/easy_install-mx6sxJ/MySQL-python-1.2.4/temp/tmp9GMCmz/distribute-0.6.28
Building a Distribute egg in /private/tmp/easy_install-mx6sxJ/MySQL-python-1.2.4
/private/tmp/easy_install-mx6sxJ/MySQL-python-1.2.4/distribute-0.6.28-py2.6.egg
cc1: error: unrecognized command line option "-Wno-null-conversion"
error: Setup script exited with error: command 'llvm-gcc-4.2' failed with exit status 1
rigo:~ rigobcastro$ 

With the llvm-gcc-4.2 error I tried install XCode and its command line tools and GCC solution. 由于llvm-gcc-4.2错误,我尝试安装XCode及其命令行工具和GCC解决方案。

I have Python 2.7.4 and Mac OSX Lion 10.7.5. 我有Python 2.7.4和Mac OSX Lion 10.7.5。

It seems to be a SSL related issue. 这似乎是与SSL相关的问题。 Here you can find the explanation. 在这里您可以找到解释。 https://github.com/pypa/pip/issues/829 https://github.com/pypa/pip/issues/829

As others mentioned before me....getting Python to work with MySQL on a Mac is a ?@#$@&%^!! 正如其他人在我之前提到的那样。...让Python在Mac上与MySQL配合使用是一个@@ $$ @&%^ !! nightmare. 恶梦。

Installed Django framework on Mac OS 10.7.5 initially from the original Django website and when the MySQLdb didn't work, and after many hours googling and trying solutions from SO, I have installed the Django stack from BitNami http://bitnami.com/stack/django 最初是从原始Django网站在Mac OS 10.7.5上安装Django框架的,当MySQLdb无法正常工作时,经过数小时的搜索和尝试SO的解决方案后,我从BitNami http://bitnami.com安装了Django堆栈。 /堆栈/ Django

Still, got the issues mentioned above and then some more... 尽管如此,还是得到了上面提到的问题,然后还有更多...

What helped me eventually is what Josh recommends on his blog: http://joshbranchaud.com/blog/2013/02/10/Errors-While-Setting-Up-Django.html 最终对我有帮助的是乔什(Josh)在他的博客上的建议: http : //joshbranchaud.com/blog/2013/02/10/Errors-While-Setting-Up-Django.html

Now Python 2.7 is finally connected to MySQL 5.5 现在,Python 2.7终于连接到MySQL 5.5

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM