MySQL Improperly Configured Reason: unsafe use of relative path(MySQL 配置不当的原因:不安全的使用相对路径)
问题描述
我正在使用 Django,当我运行 python manage.py runserver
时,我收到以下错误:
I'm using Django, and when I run python manage.py runserver
I receive the following error:
ImproperlyConfigured: Error loading MySQLdb module: dlopen(/Library/Python/2.7/site-packages/_mysql.so, 2): Library not loaded: libmysqlclient.18.dylib
Referenced from: /Library/Python/2.7/site-packages/_mysql.so
Reason: unsafe use of relative rpath libmysqlclient.18.dylib in /Library/Python/2.7/site-packages/_mysql.so with restricted binary
我不完全确定如何解决这个问题.我已经通过 pip 安装了 MySQL-python.我更早地遵循了此步骤.
I'm not entirely sure how to fix this. I have installed MySQL-python via pip. And I followed this step earlier.
我还想指出这是 El Capitan Beta 3.
I want to also point out this is with El Capitan Beta 3.
推荐答案
在 OS X El Capitan (10.11) 中,Apple 添加了 系统完整性保护.
In OS X El Capitan (10.11), Apple added System Integrity Protection.
这可以防止/usr
等受保护位置中的程序调用使用对另一个共享库的相对引用的共享库.对于_mysql.so
,它包含对共享库libmysqlclient.18.dylib
的相对引用.
This prevents programs in protected locations like /usr
from calling a shared library that uses a relative reference to another shared library. In the case of _mysql.so
, it contains a relative reference to the shared library libmysqlclient.18.dylib
.
未来可能会更新共享库_mysql.so
.在此之前,您可以通过 install_name_tool
实用程序强制它使用绝对引用.
In the future, the shared library _mysql.so
may be updated. Until then, you can force it to use an absolute reference via the install_name_tool
utility.
假设libmysqlclient.18.dylib
在/usr/local/mysql/lib/,然后运行命令:
Assuming that libmysqlclient.18.dylib
is in /usr/local/mysql/lib/, then run the command:
sudo install_name_tool -change libmysqlclient.18.dylib \
/usr/local/mysql/lib/libmysqlclient.18.dylib \
/Library/Python/2.7/site-packages/_mysql.so
这篇关于MySQL 配置不当的原因:不安全的使用相对路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:MySQL 配置不当的原因:不安全的使用相对路径


基础教程推荐
- 带更新的 sqlite CTE 2022-01-01
- 如何在 CakePHP 3 中实现 INSERT ON DUPLICATE KEY UPDATE aka upsert? 2021-01-01
- 从字符串 TSQL 中获取数字 2021-01-01
- while 在触发器内循环以遍历 sql 中表的所有列 2022-01-01
- MySQL根据从其他列分组的值,对两列之间的值进行求和 2022-01-01
- ORA-01830:日期格式图片在转换整个输入字符串之前结束/选择日期查询的总和 2021-01-01
- CHECKSUM 和 CHECKSUM_AGG:算法是什么? 2021-01-01
- 使用 VBS 和注册表来确定安装了哪个版本和 32 位 2021-01-01
- 带有WHERE子句的LAG()函数 2022-01-01
- MySQL 5.7参照时间戳生成日期列 2022-01-01