1.安装完mysqldb后,在Python中import MySQLdb时报错:
/home/test/.virtualenvs/test-env-sys/local/lib/python2.7/site-packages/pkg_resources.py:991: UserWarning: /home/test/.python-eggs is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
warnings.warn(msg, UserWarning)
其中test是用户,test-env-sys是创建的虚拟环境。大意是说这个文件可被用户组写入,导致在使用get_resource_filename时,容易受到攻击。考虑安全路径
解决办法为:
进入test目录,输入
chmod g-wx,o-wx .python-eggs/