I'm playing with my first Raspberry Pi 3 project, and I've hit a snag. I've found some example code which uses MySQL import MySQLdb as mdb, but when I try to run the code I get a 'No module named 'MySQLdb''...
I've been googling for ages now, and I'm getting no where. Here's a few of the options I've tried:
pip install mysql-python
sudo pip install mysql-python
sudo apt-get install python-mysqldb
sudo apt-get install libmysqlclient-dev
Any suggestions?
From this post, try:
apt-get install python-dev libmysqlclient-dev
pip install MySQL-python
Related
I'm trying to install Superset (Airbnb Data visualizer) on an equivalent of "PuTTY" installed by the firm I'm working for on a Windows computer, following this tutorial : http://airbnb.io/superset/installation.html
After the first lines (sudo yum install ...) I tried this line :
pip install virtualenv
And I had:
"bash: pip: command not found".
I tried the following :
sudo easy_install pip
sudo yum install python-pip
yum install -y python-pip # after a yum -y update
It still doesn't work... I have errors everytime, particularly this one :
Loaded plugins: rhnplugin, search-disabled-repos This system is
receiving updates from RHN Classic or Red Hat Satellite. No package
python-pip available. Error: Nothing to do
Then I found solutions on the web, I tried this :
rpm -ivh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
But I have an error again (Name or service not known).
I absolutely do not know what to do. Do you have an idea to solve this problem ?
Thank you for your help.
Edit : I found more détails : I use a RedHat Linux 7.2-11
I would try and install pip using the first option from the Pip page.
wget https://bootstrap.pypa.io/get-pip.py
python get-pip.py
update Error Installation ErrorI am trying to access a database using python.when i am executing my script its giving error, Import Error:-No module named MySQL . I have even tried it to run with lower versions of python but the same error came.I tried to install the MySQL package using the command sudo apt-get install python-mysqldb but it throwing some error.
So i write a answer, so that the question could be marked as "answered".
The problem was losing internet connection. APT need internet connection to download the packages from source.
For someone, who want to install python module MySQLDB in Debian or Ubuntu:
apt-get update
apt-get install python-mysqldb
If you want to install MySQLDB from pip, you need to install all the prerequisites for python-mysqldb first (for virtualenv)
apt-get build-dep python-mysqldb
pip install mysql-python
I am very new to Ubuntu OS and Python as well. I want to install Django. But i dont have easy_install and I tried below command to install pip
sudo apt-get install python-pip
I got an error as below
Unable to locate package python-pip
I tried below command as well
sudo apt-get install python-pip
and i got error as below
E: Package 'python-setuptools' has no installation candidate
I am very confused in installing django, How to successfully install django
First update repositories
sudo apt-get update
then try
sudo apt-get install python-pip python-dev build-essential python-setuptools
if nothing, you can install pip and setuptools packages manually. Download them from PyPI.
Install pip
To install or upgrade pip, securely download get-pip.py.
Then run the following (which may require administrator access):
sudo python get-pip.py
If setuptools (or distribute) is not already installed, get-pip.py will install setuptools for you.
To upgrade an existing setuptools (or distribute), run pip install -U setuptools
Upgrade pip
On Linux or OS X:
sudo pip install -U pip
Then you can download django using pip,
sudo pip install django
Install
First you need make sure you have Python install, here I take 2.7.6 as example. For how to install Python, you can go check this link:
https://askubuntu.com/questions/443048/python-2-7-6-on-ubuntu-12-04-how-to
Then you can start install Django and setup database as follow:
sudo apt-get install python-django
sudo apt-get install mysql-server
sudo apt-get install python-mysqldb
You can find more configuration detail in this link
http://yuwenqing.org/?p=108
Also, for less pain in future develop, you should deploy your Django application in python virtualEnv, here are some detail of why you need virtualEnv.
http://yuwenqing.org/?p=126
After I installed Mariadb 10 the Mysql workbench and JPDB client both connect and work fine so next step was get programming with Python (using SQLAlchemy) which seems to require MySQL-python so I went to update that and got:
"mysql_config not found" I looked in the "usual places" and did not see a file...
So I followed some ideas from an earlier question on SO
and tried to install: apt-get install libmysqlclient-dev
which got me to:
The following packages have unmet dependencies:
libmysqlclient-dev : Depends: libmysqlclient18 (= 5.5.35-0ubuntu0.13.10.2) but 10.0.10+maria-1~saucy is to be installed
which kind of hits a brick wall for me
For Centos 7.0 install the following:
yum install mariadb-devel
For Fedora 23+:
dnf install mariadb-devel
Found it! The case is that mariadb has a compatible package, if you have the ppa setup as in http://downloads.mariadb.org/. Just
sudo apt-get install libmariadbclient-dev
Thanks to http://data-matters.blogspot.com/2013/08/install-mysql-python-with-mariadb.html
After this the mysql-python installs correctly
There's NO solution on Ubuntu 16.04
Doing:
sudo ln -s /usr/bin/mariadb_config /usr/bin/mysql_config
Worked for me.
Install the following library:
sudo apt-get install libmariadb-client-lgpl-dev
And create a symbolic link named mysql_config:
ln -s /usr/bin/mariadb_config /usr/bin/mysql_config
For Debian/Ubuntu PPA from https://downloads.mariadb.org/mariadb/repositories/
for MariaDB 10.1: apt-get install libmariadbclient-dev
for MariaDB 10.2: apt-get install libmariadb-dev
for MariaDB 10.3: apt-get install libmariadb-dev-compat
On Ubuntu 17.04 the following worked for me
sudo apt-get install default-libmysqlclient-dev
For Debian Jessie:
sudo apt-get install libmariadb-client-lgpl-dev
sudo ln -s /usr/bin/mariadb_config /usr/bin/mysql_config
I download and install the transifex with several steps but I always get Error cannot import name six:
apt-get install python-dev
apt-get install gcc make
install python python-setuptools python-imaging
easy_install transifex
easy_install pip
pip install django-celery
How can I run the transifex without error?
I had the same problem. In my case, there were some unneeded libraries floating around that got in the way, and sudo apt autoremove fixed it. I was also missing urllib3.exceptions, which I installed with pip install urllib3.