MySQL Django mysqlclient 安装

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30015983/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-31 20:58:10  来源:igfitidea点击:

Django mysqlclient install

mysqldjangodatabasepython-3.xinstallation

提问by dzenesiz

I am trying to start learning Django, but I can't even pass through the installation. I have Python 3.4, Django, setuptools and Apache installed. Is database all that is left to setup?

我正在尝试开始学习 Django,但我什至无法通过安装。我安装了 Python 3.4、Django、setuptools 和 Apache。数据库剩下的就是设置了吗?

Also, I wanted to try with MySQL and this is the link from djangoproject: https://pypi.python.org/pypi/mysqlclient

另外,我想尝试使用 MySQL,这是来自 djangoproject 的链接:https://pypi.python.org/pypi/mysqlclient

The problem is that I can't find any information on what .whl file should I download, how to open it and if that is all I have to do. I dont get why there isn't some integrated Django developement kit or something, but that is a question for some other forum :)

问题是我找不到关于我应该下载什么 .whl 文件、如何打开它以及如果这就是我必须做的全部内容的任何信息。我不明白为什么没有一些集成的 Django 开发工具包或其他东西,但这是其他论坛的问题:)

回答by Daniel Roseman

You don't download the whl file yourself. You use pip to install it directly:

您不必自己下载 whl 文件。你用pip直接安装:

pip install mysqlclient.

Note that you don'tneed this to try Django; nor do you need Apache. Python and Django is already an "integrated development environment" since Python includes sqlite3, and Django includes a development server.

请注意,您并不需要这个尝试Django的; 你也不需要Apache。Python 和 Django 已经是一个“集成开发环境”,因为 Python 包含 sqlite3,而 Django 包含一个开发服务器。

回答by Joseph jun. Melettukunnel

I'd recommend that you read up the basics of virtualenv(http://docs.python-guide.org/en/latest/dev/virtualenvs/) and continue from there.

我建议您阅读virtualenvhttp://docs.python-guide.org/en/latest/dev/virtualenvs/)的基础知识并从那里继续。

Basically following commands should get you running:

基本上以下命令应该让你运行:

$ cd ~/your_project_directory
$ virtualenv env
$ source env/bin/activate
$ pip install django
$ pip install mysql-python

Make sure you have MySQL (server) installed on your system. If you're on Mac OS X, brew(http://brew.sh/) is quite handy.

确保您的系统上安装了 MySQL(服务器)。如果您使用的是 Mac OS X,brew( http://brew.sh/) 非常方便。

回答by Kush Pathak

You don't have to download any whl file

您不必下载任何 whl 文件

pip install mysqlclient

will work just fine . In case you get any Microsoft Visual C++ error try

会工作得很好。如果您遇到任何 Microsoft Visual C++ 错误,请尝试

 pip install --only-binary :all: mysqlclient?

hope it helps .

希望能帮助到你 。

回答by rabiaasif

brew install mysql-connector-c
brew install mysql
brew unlink mysql-connector-c
sudo pip install pymysql
sudo pip install mysqlclient

Try running these commands on the terminal to install mysqlclient

尝试在终端上运行这些命令来安装 mysqlclient

回答by Tuke TV

Here is my solution. Make sure your virtualenv is activated, then type the following:

这是我的解决方案。确保您的 virtualenv 已激活,然后键入以下内容:

apt-get install default-libmysqlclient-dev
pip install mysqlclient

回答by OlaJens

easy to miss the 64-bit

容易错过的64位

You might got the wrong bit version of Python. Check that your bit version of python is correct. I by misstake downloaded the 32-bit version of Python and I got the same issue as you. I could do pip install mysqlclientwith the 64-bit version without any issues.

您可能使用了错误的 Python 位版本。检查您的python 位版本是否正确。我错误地下载了 32 位版本的 Python,我遇到了和你一样的问题。我可以pip install mysqlclient使用 64 位版本而没有任何问题。

(note that the windowsx86 on the image is 32-bit)

(注意图片上的windowsx86是32位的)