English 中文(简体)
Failed Building wheel for mysql-python
原标题:Failed building wheel for mysql-python

I want to run a Django application in PyCharm which works on MySQL DB.

我无法把我的方案与数据库联系起来。

当我试图安装MySQLclient或MySQL-python时,我正在犯错误:

MySQLclient的车道

请帮助我把我的Django方案与MySQL数据库联系起来。

问题回答

Edit

请尝试从。 每次都这样做。 Just category pip装置 MySQL_python‐1.2.5‐cp27‐none‐win32.whl in the码头。

Original Answer

我也有同样的问题。 你可能认为这些步骤是有益的。

  1. Make sure you are in an activated virtualenv when you are installing anything through pip.
  2. Before you install anything, type pip list in the terminal to see what you have installed in the virtualenv. It should have wheel, setuptools and pip.
  3. This is the part that helped me, type pip install mysqlclient==1.3.9 or whatever version you want to install. This needs to happen before you install django.
  4. Hopefully, it works and you can go ahead and install Django.

If these steps didn t work out for you, try installing MySQL-Python through the executable file here https://pypi.python.org/pypi/MySQL-python/1.2.5.

但是,这只会为系统中的各位安装我的头巾。 您可在虚拟台外尝试<代码>pip List,看看是否安装了我sql-python。 如果安装了这个员额,那么你就更新了这个员额,以便我们能够找到解决办法。

In the meantime some other fixes are:

  • Can t install mysql-python (newer versions) in Windows
  • Install Visual C++ for Python and add the bin folder to the PATH environment variable.
  • Make sure the mysql service is running in the background or is installed in your system by running mysql commands through the terminal.
  • Sometimes, two different instances of mysql service might cause this error i.e. if you have installed mysql server or any other product multiple times in the past, you might have to get rid of the ports the past services used. In this case, do a fresh installation of mysql server and add the ~in path to the PATH environment variable.

I had the same problem. I then uninstalled my python. Downloaded the python 3.6.5. then used a command from

https://stackoverflow.com/q/51117503/5719810> 3.7. MySql-Python()的Failed Building wheel

指挥系统为pip安装了我sqlclient==1.3.12

In case you are using sqlalchemy(which implicitly uses mysql-python) to connect to a MySQL database, updating it using pip install sqlalchemy --upgrade might do the trick and while creating a connection using an engine the syntax should be:

from sqlalchemy import create_engine


HOST = "your_host_name.host.com"
USER = "your_username"
PASSCODE = "your_passcode"
DATABASE = "name_of_database"

engine = create_engine(f mysql+mysqldb://{USER}:{PASSCODE}@{HOST}/{DATABASE} )

我找到了在Windows 10 64 bit、Django 版本3.10.0上安装神秘器的解决办法。

  1. Download preferred mysqlclient wheel for your OS/bit size. here : https://pypi.tuna.tsinghua.edu.cn/simple/mysqlclient/

  2. Point to the directory such as C:UsershpDesktopstorefrontstore from your prompt or terminal

  3. 用pip i.e安装:C:UsershpDesktopstorefrontstore > pip安装了我的sqlclient-2.1.0-cp310-cp310-win_amd64.whl

“printeck”</p





相关问题
SQL SubQuery getting particular column

I noticed that there were some threads with similar questions, and I did look through them but did not really get a convincing answer. Here s my question: The subquery below returns a Table with 3 ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

php return a specific row from query

Is it possible in php to return a specific row of data from a mysql query? None of the fetch statements that I ve found return a 2 dimensional array to access specific rows. I want to be able to ...

Character Encodings in PHP and MySQL

Our website was developed with a meta tag set to... <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> This works fine for M-dashes and special quotes, etc. However, I ...

Pagination Strategies for Complex (slow) Datasets

What are some of the strategies being used for pagination of data sets that involve complex queries? count(*) takes ~1.5 sec so we don t want to hit the DB for every page view. Currently there are ~...

Averaging a total in mySQL

My table looks like person_id | car_id | miles ------------------------------ 1 | 1 | 100 1 | 2 | 200 2 | 3 | 1000 2 | 4 | 500 I need to ...

热门标签