【发布时间】:2016-06-26 04:02:02
【问题描述】:
在将其标记为重复之前,请仔细阅读。
我正在尝试在依赖于 pyparsing 模块的脚本中使用 pydot。但是我拥有的模块是 MAC 安装附带的 pyparsing 2.0.1。这需要降级到 1.5.7 以修复此错误 - “无法导入 dot_parser,无法加载点文件”,根据 this answer,但是当我尝试卸载现有的 pyparsing 模块时,我得到了这个错误 -
pip uninstall pyparsing
DEPRECATION: Uninstalling a distutils installed project (pyparsing) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling pyparsing-2.0.1:
/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/pyparsing-2.0.1-py2.7.egg-info
Proceed (y/n)?
如果我按预期给出“是”,由于 Mac OS X 中的系统完整性保护,这会引发 Operation not allowed 错误。所以我无法继续此操作。
我试图查看我的模块路径,
import site; site.getsitepackages()
['/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python',
'/Library/Python/2.7/site-packages']
我的站点包下也可以看到pyparsing 2.0.1,有没有办法单独卸载它而不修改系统库下的pyparsing?
【问题讨论】:
-
你说卸载pyparsing,但听起来你要升级 pyparsing?
-
我不想升级,如果您看到我尝试关注的链接,那就是为我收到的错误提供的解决方案,它说要卸载最新版本 2.0.1 并安装 1.5.7 到解决这个问题。更新了问题以使其清楚。
-
/Library/Python/不会导致更改问题(例如,它不在 Mac 的 SIP 下)? -
是的,我知道。这就是为什么我要问有没有办法单独在 /Library/Python 下卸载 pyparsing?因为当我指定 pip uninstall pyparsing 时,它会自动尝试在系统库下卸载 pyparsing。如果您看到我遇到的错误。
-
注意:链接问题中的第二个答案建议改用 pydot2 。这样可以避免降级。为什么你不能使用它?
标签: python macos python-2.7