Django mysqlclient install

2019-03-26 14:36发布

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?

Also, I wanted to try with MySQL and this is the link from 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 :)

5条回答
ら.Afraid
2楼-- · 2019-03-26 14:43

You don't have to download any whl file

pip install mysqlclient

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

 pip install --only-binary :all: mysqlclient

hope it helps .

查看更多
放荡不羁爱自由
3楼-- · 2019-03-26 14:43

easy to miss the 64-bit

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 mysqlclient with the 64-bit version without any issues.

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

查看更多
Rolldiameter
4楼-- · 2019-03-26 14:50
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

查看更多
对你真心纯属浪费
5楼-- · 2019-03-26 15:06

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

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.

查看更多
祖国的老花朵
6楼-- · 2019-03-26 15:09

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

pip install mysqlclient.

Note that you don't need 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.

查看更多
登录 后发表回答