15

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 :)

dzenesiz
  • 1,388
  • 4
  • 27
  • 58

7 Answers7

30

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.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895
18

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.

Joseph jun. Melettukunnel
  • 6,267
  • 20
  • 69
  • 90
  • 2
    So, when I'm in the virtual environment, i install the software package that I need with "pip install " similarly to debian's "sudo apt-get "? – dzenesiz May 04 '15 at 19:01
  • 3
    Let's take this example: "Project A" requires Django==1.4.1 and "Project B" requires Django==1.6.7. If you install the packages system wide with pip (yes, like "apt-get"), this could mess up one setup. Virtualenv helps to you to separate the dependencies. – Joseph jun. Melettukunnel May 05 '15 at 17:36
  • 1
    i hate to bother any further, but the command 'source env/bin/activate' didn't work. However, inside the project directory's env folder, I found 'activate' inside Scripts directory. I presume that the 'cd env -> cd scripts -> activate' command sequence will do the trick? – dzenesiz May 06 '15 at 00:07
  • 2
    Are you on a windows machine? Then yes, scripts directory. Again, I'd recommend to read the documentation (e.g. https://virtualenv.pypa.io/en/latest/userguide.html) – Joseph jun. Melettukunnel May 06 '15 at 10:23
  • I did read it, though not thoroughly because of deadlines. It works like a charm. I know I shouldn't be going around thanking people here, but you provided valuable help. I appreciate it. – dzenesiz May 06 '15 at 14:43
10

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

apt-get install default-libmysqlclient-dev
pip install mysqlclient
Ann Kilzer
  • 1,266
  • 3
  • 16
  • 39
Luqman Tuke
  • 119
  • 2
  • 7
5

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 .

Kush Pathak
  • 83
  • 1
  • 4
1
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

rabiaasif
  • 305
  • 3
  • 6
  • 21
0

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)

OlaJens
  • 98
  • 7
0

I solved through these steps:

pip install --upgrade pip

pip install --upgrade setuptools

pip install mysqlclient==1.4.6

if mysqlclient==1.4.6 will not work then try some other versions

pip install mysqlclient==x.x.x