安装ryu

安装系统:ubuntu22.04(AMD64 (x86_64), Intel x86)

依赖项    gcc python3-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev zlib1g-dev

所需软件  pip3  python3.10

官方文档Getting Started — Ryu 4.34 documentationicon-default.png?t=N7T8https://ryu.readthedocs.io/en/latest/getting_started.html

目录

一、安装前配置

1.配置apt源

2.安装前置软件

二、安装ryu

1.拉取git库

2.安装

二、排错

1.TypeError: cannot set 'is_timeout' attribute of immutable type 'TimeoutError'

2.module 'collections' has no attribute 'MutableMapping'

三、安装完成


一、安装前配置

1.配置apt源

这里使用中科大的apt源Ubuntu 源使用帮助 — USTC Mirror Help 文档icon-default.png?t=N7T8https://mirrors.ustc.edu.cn/help/ubuntu.html

sudo sed -i 's/security.ubuntu.com/mirrors.ustc.edu.cn/g' /etc/apt/sources.list

2.安装前置软件

sudo apt update
sudo apt upgrade
sudo -i #切换到root用户
apt install gcc python3-dev libffi-dev libssl-dev libxml2-dev libxslt1-dev zlib1g-dev git python3-pip

二、安装ryu

1.拉取git库

git clone https://gitclone.com/github.com/faucetsdn/ryu.git

2.安装

cd ryu
pip3 install .

二、排错

1.TypeError: cannot set 'is_timeout' attribute of immutable type 'TimeoutError'

root@han-virtual-machine:~/ryu/bin# ryu-manager 
Traceback (most recent call last):
  File "/usr/local/bin/ryu-manager", line 5, in <module>
    from ryu.cmd.manager import main
  File "/usr/local/lib/python3.10/dist-packages/ryu/cmd/manager.py", line 22, in <module>
    from ryu.lib import hub
  File "/usr/local/lib/python3.10/dist-packages/ryu/lib/hub.py", line 30, in <module>
    import eventlet
  File "/usr/local/lib/python3.10/dist-packages/eventlet/__init__.py", line 17, in <module>
    from eventlet import convenience
  File "/usr/local/lib/python3.10/dist-packages/eventlet/convenience.py", line 7, in <module>
    from eventlet.green import socket
  File "/usr/local/lib/python3.10/dist-packages/eventlet/green/socket.py", line 4, in <module>
    __import__('eventlet.green._socket_nodns')
  File "/usr/local/lib/python3.10/dist-packages/eventlet/green/_socket_nodns.py", line 11, in <module>
    from eventlet import greenio
  File "/usr/local/lib/python3.10/dist-packages/eventlet/greenio/__init__.py", line 3, in <module>
    from eventlet.greenio.base import *  # noqa
  File "/usr/local/lib/python3.10/dist-packages/eventlet/greenio/base.py", line 32, in <module>
    socket_timeout = eventlet.timeout.wrap_is_timeout(socket.timeout)
  File "/usr/local/lib/python3.10/dist-packages/eventlet/timeout.py", line 166, in wrap_is_timeout
    base.is_timeout = property(lambda _: True)
TypeError: cannot set 'is_timeout' attribute of immutable type 'TimeoutError'

解决方法

pip install https://ghproxy.com/https://github.com/eventlet/eventlet/archive/master.zip

2.module 'collections' has no attribute 'MutableMapping'

root@han-virtual-machine:~/ryu/bin# ryu-manager
Traceback (most recent call last):
  File "/usr/local/bin/ryu-manager", line 5, in <module>
    from ryu.cmd.manager import main
  File "/usr/local/lib/python3.10/dist-packages/ryu/cmd/manager.py", line 22, in <module>
    from ryu.lib import hub
  File "/usr/local/lib/python3.10/dist-packages/ryu/lib/hub.py", line 30, in <module>
    import eventlet
  File "/usr/local/lib/python3.10/dist-packages/eventlet/__init__.py", line 17, in <module>
    from eventlet import convenience
  File "/usr/local/lib/python3.10/dist-packages/eventlet/convenience.py", line 7, in <module>
    from eventlet.green import socket
  File "/usr/local/lib/python3.10/dist-packages/eventlet/green/socket.py", line 21, in <module>
    from eventlet.support import greendns
  File "/usr/local/lib/python3.10/dist-packages/eventlet/support/greendns.py", line 79, in <module>
    setattr(dns, pkg, import_patched('dns.' + pkg))
  File "/usr/local/lib/python3.10/dist-packages/eventlet/support/greendns.py", line 61, in import_patched
    return patcher.import_patched(module_name, **modules)
  File "/usr/local/lib/python3.10/dist-packages/eventlet/patcher.py", line 132, in import_patched
    return inject(
  File "/usr/local/lib/python3.10/dist-packages/eventlet/patcher.py", line 109, in inject
    module = __import__(module_name, {}, {}, module_name.split('.')[:-1])
  File "/usr/local/lib/python3.10/dist-packages/dns/namedict.py", line 35, in <module>
    class NameDict(collections.MutableMapping):
AttributeError: module 'collections' has no attribute 'MutableMapping'

解决方法

修改/usr/local/lib/python3.10/dist-packages/dns/namedict.py第35行

将collections.MutableMapping替换为collections.abc.MutableMapping

class NameDict(collections.abc.MutableMapping):    #line 35

三、安装完成

root@han-virtual-machine:~/ryu/bin# ryu-manager --version
ryu-manager 4.34

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 12
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值