求助:安装Ryu时遇AttributeError,setuptools无get_script_args属性
解决Ryu安装时的AttributeError问题
尝试安装Ryu多日始终无法解决报错,工作陷入停滞,急需完成安装以推进工作。执行命令时出现如下错误:
fani@fani-VMware-Virtual-Platform:~/ryu$ pip install . --break-system-packages Defaulting to user installation because normal site-packages is not writeable Processing /home/fani/ryu Preparing metadata (setup.py) ... error error: subprocess-exited-with-error × python setup.py egg_info did not run successfully. │ exit code: 1 ╰─> [9 lines of output] Traceback (most recent call last): File "<string>", line 2, in <module> File "<pip-setuptools-caller>", line 34, in <module> File "/home/fani/ryu/setup.py", line 21, in <module> ryu.hooks.save_orig() File "/home/fani/ryu/ryu/hooks.py", line 36, in save_orig _main_module()._orig_get_script_args = easy_install.get_script_args ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ AttributeError: module 'setuptools.command.easy_install' has no attribute 'get_script_args' [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. error: metadata-generation-failed × Encountered error while generating package metadata. ╰─> See above for output. note: This is an issue with the package mentioned above, not pip. hint: See above for details.
解决方法
- 降级setuptools到兼容版本:新版本setuptools移除了
easy_install.get_script_args接口,Ryu旧代码依赖该接口。执行以下命令降级后重新安装Ryu:pip install setuptools==58.0.4 --break-system-packages pip install . --break-system-packages - 使用虚拟环境隔离依赖:避免修改系统包,创建专属虚拟环境后安装:
python -m venv ryu-env source ryu-env/bin/activate pip install . - (不推荐)修改Ryu源码:找到
/home/fani/ryu/ryu/hooks.py,注释掉或删除引用easy_install.get_script_args的相关代码,但可能引发其他兼容性问题。
内容的提问来源于stack exchange,提问作者farhan jatt
相关产品推荐
相关产品推荐

