我目前正在尝试在ubuntu上安装mysqlclient-python以与Django一起使用并遇到问题。
我正在关注此页:https://github.com/PyMySQL/mysqlclient-python
然而,当我运行' pip install mysqlclient'我收到以下错误:
running install_lib
copying build/lib.linux-x86_64-2.7/_mysql_exceptions.py -> /usr/local/lib/python2.7/dist-packages
error: [Errno 13] Permission denied: '/usr/local/lib/python2.7/dist-packages/_mysql_exceptions.py'
----------------------------------------
Cleaning up...
Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_robofish/mysqlclient/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-ynYYW0-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_robofish/mysqlclient
Storing debug log for failure in /home/robofish/.pip/pip.log
我检查了/usr/local/lib/python2.7/
目录,它似乎是空的。这可能是问题吗?
答案 0 :(得分:5)
您似乎正在尝试在全局Python环境中安装mysqlclient。我强烈建议使用virtualenv创建一个独立的Python环境。
如果您仍想使用全局环境,请使用sudo pip install mysqlclient
。