How to Access MySQL with Python Version 3.4
2016-08-15 13:52
645 查看
http://askubuntu.com/questions/630728/how-to-access-mysql-with-python-version-3-4
How to Access MySQL with Python Version 3.4
up vote0down votefavorite | Python comes in two versions: Python 2.7.6 which has now been superseded by Python 3.4.0. The critical line in Python to access MySQL is "import MySQLdb" Thanks to a response from StackOverFlow, I realized that I was unintentionally accessing MySQL through Python version 2.7.6. Apparently, "MySQLdb" is not compatible with Python version 3.4.0. Searching the internet has disclosed alternatives for connecting Python to MySql, however, many of the suggestions do not disclose whether the offered solutions would actually work with Python version 3.4.0. This StackOverFlow Post listed some possible solutions. Python 3.4.0 with MySQL database. I installed mysqlclient 1.3.6, I also ran "sudo pip install PyMySQL" with out error. However, upon entering python with "python3"; I still received the error message "ImportError: No module named 'MySQLdb'" after typing in: "import MySQLdb". So something was still wrong. As an FYI MySQL evidently has its own connector, but I don't know whether it works or does not work with Python 3.4. Connecting to MySQL Using Connector/Python I will have to look into this more. Any advice on how to connect Python 3.4 with MySQL? python mysql
| |||
add a comment |
1 Answer
activeoldestvotesup vote0down voteaccepted | The documentation for MySQL Connector/Python says Version 2.0 should work with MySQL Server 5.5-5.7 and Python 3.3 and later. So I would say it's a good bet. If it doesn't work, follow up with what error you encounter and I'll see if I can help.
| ||||||||||||||||||||
|
相关文章推荐
- How to find the correct version of JDeveloper to use with eBusiness Suite 11i or Release 12.x
- centos howto yum install mysql-python
- (转)How to use MySQL with 3D Studio Max
- HOW-TO:Debug Python Scripts with Eclipse
- How_to_build_a_static_Qt_version_for_Windows_with_gcc | Qt Wiki | Qt Developer Network
- How to Do Everything with PHP and MySQL
- field_merge: Example code of Early Access iText(how to fill PDF form with iTextSharp)
- How Do I Enable Remote Access To MySQL Database Server?
- How to mount partition with ntfs file system and read write access
- mac下安装mysql-python包报unable to execute llvm-gcc-4.2: No such file or directory error: command 'llvm-gcc-4.2' failed with exit status 1解决方法
- How to use MySql with Linq to SQL
- How To Index For Joins With MySQL
- How to use Django with Apache and mod_python
- How To Use Linux epoll with Python
- How to install new version of mysql
- How To Look At MySQL Joins and More ORDER BY With LIMIT
- How to Do Everything with Microsoft Office Access 2003
- How to install Nginx, PHP, PHP-FPM and MySQL under Windows with Cygwin
- How Do I Enable Remote Access To MySQL Database Server?
- Funambol with Mysql: how to install (非常好的tutorial)