系统:Ubuntu16.04 环境:Python2 Python3 Anaconda/Python2
在配置好mysql的情况下,安装mysqldb报错
zqy@zqy-Mai-II:~$ sudo pip install mysql-python The directory '/home/zqy/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/zqy/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting mysql-python Downloading MySQL-python-1.2.5.zip (108kB) 100% |████████████████████████████████| 112kB 491kB/s Complete output from command python setup.py egg_info: Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-76krf8c_/mysql-python/setup.py", line 13, in <module> from setup_posix import get_config File "/tmp/pip-build-76krf8c_/mysql-python/setup_posix.py", line 2, in <module> from ConfigParser import SafeConfigParser ImportError: No module named 'ConfigParser'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-76krf8c_/mysql-python/
最后将pip改为pip2,安装成功
zqy@zqy-Mai-II:~$ sudo pip2 install mysql-python The directory '/home/zqy/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. The directory '/home/zqy/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag. Collecting mysql-python Downloading MySQL-python-1.2.5.zip (108kB) 100% |████████████████████████████████| 112kB 660kB/s Installing collected packages: mysql-python Running setup.py install for mysql-python ... done Successfully installed mysql-python-1.2.5
`