Linux environment MySQL python installation process sharing
- 2020-04-02 14:34:04
- OfStack
1. First make sure that the python version is 2.3.4 or above, if it is not the version that needs to be upgraded
Python -v Check the python version
2. Install mysql, such as in /usr/local/mysql
3. Download MySQL - python - 1.2.2. Tar. Gz
Address (link: https://sourceforge.net/projects/mysql-python/)
4. Install MySQl - python
tar xvzf MySQL-python-1.2.2.tar.gz
cd MySQL-python-1.2.2
vi site.cfg
The mysql_config = / usr/local/mysql/bin/mysql_config # remove before this line, and the mysql_config path have been correctly set.
python setup.py build
sudo python setup.py install
Install the end
5. Test
Run: python
import MySQLdb
If no error is reported, it is installed.