Windows pip install mysql

Installing mysqlclient in Python 3.6 in windows

I want to install MySqlclient on my windows system. I am Currently using Python 3.6. After going through the various post over Stackoverflow, I could Not find the correct way. This is what I have done so far:

1) Installation by using pip pip install mysqlclient . Error:

I already have Microsoft Visual C++ installed on my laptop. Some are saying you need 2015 edition.

2) Installation by using wheel file pip install mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl . Error:

Requirement mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl looks like a filename, but the file does not exist. mysqlclient-1.3.13-cp36-cp36m-win_amd64.whl is not a supported wheel on this platform.

2.1) Changing the whl file to different version pip install mysqlclient-1.3.13-cp36-cp36m-win32.whl . Error:

Could not install packages due to an EnvironmentError: [Errno 2] No such file or directory: ‘C:\\Users\\Foxtrot\\Desktop\\finaltest\\mysqlclient-1.3.13-cp36-cp36m-win32.whl’

Other things that are done: updated setuptools, updated wheel.

9 Answers 9

I can’t find mysqlclient-1.3.13’s whl file on PyPi. So you need to compile it from source. Unfortunately it’s not easy. I’m not Windows guy, so I only can recommend guide like this

Had the same problem, searched the web etc. Here this answer:

It has all the instructions. In short go to this site: https://www.lfd.uci.edu/

There you will find mysqlclient‑1.3.13‑cp36‑cp36m‑win32.whl mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl

Download the correct file for your platform.

Then use your downloaded wheels file with pip and your done:

pip install c:\mysqlclient‑1.3.13‑cp36‑cp36m‑win_amd64.whl

gohlke/pythonlibs has lots of lots of compiled libaries to solve the problem of building them from source yourself. They even compile them for python 3.7 🙂

Alternative Solution

You can also download Visual C++ Build Tools and then you should be able to install every (at least to my knowledge) version of mysqlclient with pip. To do this go to this site: https://www.scivision.co/python-windows-visual-c++-14-required/ there you can find out which version of Build Tools you need and you can also find a link to download the installer. Be aware though Build Tools require more than 4GB of free disk space.

I am using python3.7 on Windows 10 operating system. I had same issue and after a long research I had installed it successfully.

Install «Microsoft Visual C++ Build Tools» AND My OS is having 64 bit operating system but still then it need to install 32 bit version «mysqlclient‑1.4.2‑cp37‑cp37m‑win32.whl»

pip install [path_to_downloaded_file] eg: C:\Users\Ds\mysqlclient-1.4.2-cp37-cp37m-win32.whl

use pipenv instead of pip if you are using virtual environment.

The error means that the package has not yet been compiled for your versions of OS and Python. So pip tries to build it from the source for you.

There are two possible solutions.

The first option is to install the most recent version of Microsoft Visual C++ Build Tools. Just go ahead and download it from the Microsoft website. Then pip should be able to compile the package.

Another option is using an unofficial binary. As mentioned here, a resource proved to be useful is https://www.lfd.uci.edu/

gohlke/pythonlibs/#mysql-python . Just download the pre-compiled package and install it using

pip install c:\path-to-a-pre-compiled-package

Tell pip not to use sources and use binary packages instead:

Читайте также:  Intel rst windows 10 как установить

Had the same problem just day. Tried to install mysqlclient on a Windows Server R2.

«MySQL Connector C 6.1» was installed in the wrong directory: «C:\Program Files\MySQL» instead of «C:\Program Files (x86)\MySQL» where it should be for me.
—> Copied «MySQL Connector C 6.1» to «C:\Program Files (x86)\MySQL» Directory.

«C:\Users\MoBoo\AppData\Local\Temp» was Read-Only: Therefore pip couldn’t compile files into Temp dir.
—> Allow Write access to «C:\Users\MoBoo\AppData\Local\Temp» Directory.

Here is what worked for me. I uninstalled mysql and re-installed it.

Then simply re-install, so it picked the current version «1.4.2.post1»

Which interestingly, works straightaway.

for this error, most of user’s suggest to install vs build but there is an alternative which works perfectly in my case and is sure for you too. Download latest MySQL client from here mysqlclients

Here you can see many version but prefer to download the latest one which has 32 bit and 64-bit files. download theme and past the file on your projects root folder then run the same command but with the full file name of downloaded mysqlclient.

in my case, the file is this also if have already the XAMPP server then you can use its PHPMyAdmin with python. You just need to change on your roots setting.py file for this. Something like this

The port is the same which you see on xampp panel just before the start button of MySQL. After changing this you just again start your server by hitting this command

If you didn’t see any error then congratulations you successfully connected with MySQL database.

How to install MySQL Connector for Python on Windows when according to the installation manager Python is not installed?

I’ve been struggling outstandingly lot with the installation of MySQL for Python recently. I’ve read all forum comments that I could find, either here or other related forums, but none of the recommendations seemed to help. Below are some details.

When I try to start the installation of MySQL connector the following error message pops up immediately: «Python v3.4 not found. We only support Python installed uing the Microsoft Windows Installer (MSI) downloaded from http://www.python.org/download/. Please check the Connector/Python manual on http://dev.mysql.com/doc for more info.«

My operating system: Windows 7, 64-bit version Python is correctly installed from here, version: 3.4.0, Windows x86-64 MSI installer

MySQL Connector is from here

I’ve set my environmental variables (My Computer > Properties > Advanced System Settings > Environment Variables), first I tried to add C:\Python34\ to path, later I created a new environmental variable with the name ‘PythonPath’ and loaded C:\Python34 and all its subfolders in it.

I uninstalled and reinstalled both the Python version and MySQL, it didn’t help. I don’t have any other older version of Python installed. Later I reinstalled Python again because I read in one of the posts that installing the software for all users of the computer might help. Neither this helped me.

I tried the installation via the command prompt, it didn’t help either.

Someone recommended me to uninstall Python 64-bit version and install the 32-bit version instead but I’m bound to version 3.4.0 and apparently 32-bit edition doesn’t exist for this version.

If you had any advice I would be really grateful because I’m getting awfully desperate with all this.

Edit: When I tried it with pip in command line with this statement: pip install MySQL-python, I got the following error message: Could not find a version that satisfies the requirement MySQL-python==2.1.7 (from versions: 1;2;4b5 . 1.2.4b4] ) Then I tried to install the latest version offered by the error message and I arrived at a new error: Command python setup.py egg_info failed with error code 1 in C:\Users.

Читайте также:  Udp открывает порт linux

Edit no2: Again command window: pip install mysql-python has led to: Command C:\Python34. mysql-python\setup.py . compile failed with error code 1.

Edit no3: I forgot to mention above that the original problem occurred when I wanted to run my program (working with databases) in the command window. It didn’t run, instead gave the error of ImportError: No module names ‘mysql’. Thus, I started to look for ways of installing the missing module.

How to install Python MySQLdb module using pip?

How can I install the MySQLdb module for Python using pip?

20 Answers 20

It’s easy to do, but hard to remember the correct spelling:

If you need 1.2.x versions (legacy Python only), use pip install MySQL-python

Note: Some dependencies might have to be in place when running the above command. Some hints on how to install these on various platforms:

Ubuntu 14, Ubuntu 16, Debian 8.6 (jessie)

Fedora 24:

Mac OS

if that fails, try

Starting from a fresh Ubuntu 14.04.2 system, these two commands were needed:

Just doing the «pip install» by itself did not work.

Then put the code below into __init__.py ( projectname/__init__.py )

My environment is (python3.5, django1.10) and this solution works for me!

Hope this helps!!

I had problems installing the 64-bit version of MySQLdb on Windows via Pip (problem compiling sources) [32bit version installed ok]. Managed to install the compiled MySQLdb from the .whl file available from http://www.lfd.uci.edu/

For example if you save in C:/ the you can install via

pip install c:/MySQL_python-1.2.5-cp27-none-win_amd64.whl

Follow-up: if you have a 64bit version of Python installed, then you want to install the 64-bit AMD version of MySQLdb from the link above [i.e. even if you have a Intel processor]. If you instead try and install the 32-bit version, I think you get the unsupported wheel error in comments below.

gohlke/pythonlibs/#mysql-python to download whl file (I dl’d 64 bit to match my 64 bit Python install). Saved file into c:/ directory and ran pip install c:/MySQL_python-1.2.5-cp27-none-win_amd64.whl It installed in seconds and was good to go. Too easy! – curtisp Oct 11 ’16 at 18:43

well this worked for me:

this is for python 3.x

Go to pycharm then go to default setting —> pip (double click) — pymsqldb..— > install —after installing use in a program like this

I tried all the option but was not able to get it working on Redhat platform. I did the following to make it work:-

Once the package was installed was able to import module as follows in the interpreter:-

If you are unable to install mysqlclient you can also install pymysql:

pip install pymysql

This works same as MySqldb. After that use pymysql all over instead of MySQLdb

Many of the given answers here are quite confusing so I will try to put it simply. It helped me to install this

and then use the following command in the python file

This way you can use MySQLdb without any problems.

If you are use Raspberry Pi [Raspbian OS]

There are need to be install pip command at first

So that just install Sequently

You can go to this website to download the package.

I had the same problem too.Follow these steps if you are on Windows. Go to: 1.My Computer 2.System Properties 3.Advance System Settings 4. Under the «Advanced» tab click the button that says «Environment Variables» 5. Then under System Variables you have to add / change the following variables: PYTHONPATH and Path. Here is a paste of what my variables look like: python path:

Читайте также:  Драйвера genius videocam eye для windows

See this link for reference

The above answer is great, but there may be some problems when we using pip to install MySQL-python in Windows

for example,It needs some files that are associated with Visual Stdio .One solution is installing VS2008 or 2010……Obviously,it cost too much.

Another way is the answer of @bob90937 . I am here to do something to add.

gohlke/pythonlibs, u can download many Windows binaries of many scientific open-source extension packages for the official CPython distribution of the Python programming language.

Back to topic,we can choose the MySQL-python(py2) or Mysqlclient(py3) and use pip install to install. it gives us Great convenience!

mysqlclient 2.0.3

pip install mysqlclient Copy PIP instructions

Released: Jan 1, 2021

Python interface to MySQL

Statistics

View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery

License: GNU General Public License (GPL) (GPL)

Requires: Python >=3.5

Maintainers

Classifiers

  • Development Status
    • 5 — Production/Stable
  • Environment
    • Other Environment
  • License
    • OSI Approved :: GNU General Public License (GPL)
  • Operating System
    • MacOS :: MacOS X
    • Microsoft :: Windows :: Windows NT/2000
    • OS Independent
    • POSIX
    • POSIX :: Linux
    • Unix
  • Programming Language
    • C
    • Python
    • Python :: 3
    • Python :: 3.6
    • Python :: 3.7
    • Python :: 3.8
    • Python :: 3.9
  • Topic
    • Database
    • Database :: Database Engines/Servers

Project description

mysqlclient

This is a fork of MySQLdb1.

This project adds Python 3 support and bug fixes. I hope this fork is merged back to MySQLdb1 like distribute was merged back to setuptools.

Support

Do Not use Github Issue Tracker to ask help. OSS Maintainer is not free tech support

When your question looks relating to Python rather than MySQL:

Or when you have question about MySQL:

Install

Windows

Building mysqlclient on Windows is very hard. But there are some binary wheels you can install easily.

macOS (Homebrew)

Install MySQL and mysqlclient:

If you don’t want to install MySQL server, you can use mysql-client instead:

Linux

Note that this is a basic step. I can not support complete step for build for all environment. If you can see some error, you should fix it by yourself, or ask for support in some user forum. Don’t file a issue on the issue tracker.

You may need to install the Python 3 and MySQL development headers and libraries like so:

  • $ sudo apt-get install python3-dev default-libmysqlclient-dev build-essential # Debian / Ubuntu
  • % sudo yum install python3-devel mysql-devel # Red Hat / CentOS

Then you can install mysqlclient via pip now:

Customize build (POSIX)

mysqlclient uses mysql_config or mariadb_config by default for finding compiler/linker flags.

You can use MYSQLCLIENT_CFLAGS and MYSQLCLIENT_LDFLAGS environment variables to customize compiler/linker options.

Documentation

Documentation is hosted on Read The Docs

Project details

Statistics

View statistics for this project via Libraries.io, or by using our public dataset on Google BigQuery

License: GNU General Public License (GPL) (GPL)

Requires: Python >=3.5

Maintainers

Classifiers

  • Development Status
    • 5 — Production/Stable
  • Environment
    • Other Environment
  • License
    • OSI Approved :: GNU General Public License (GPL)
  • Operating System
    • MacOS :: MacOS X
    • Microsoft :: Windows :: Windows NT/2000
    • OS Independent
    • POSIX
    • POSIX :: Linux
    • Unix
  • Programming Language
    • C
    • Python
    • Python :: 3
    • Python :: 3.6
    • Python :: 3.7
    • Python :: 3.8
    • Python :: 3.9
  • Topic
    • Database
    • Database :: Database Engines/Servers

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you’re not sure which to choose, learn more about installing packages.

Оцените статью