记录在Ubuntu14.04上安装ryu中遇到的各种坑
发布日期:2022-03-18 18:19:27 浏览次数:1 分类:技术文章

本文共 14837 字,大约阅读时间需要 49 分钟。

我使用的是mininet官方的Ubuntu14.04镜像.

先是运行如下命令:

apt install python-pippip install ryu

结果如下:

Downloading/unpacking ryu  Downloading ryu-4.30.tar.gz (1.5MB): 1.5MB downloaded  Running setup.py (path:/tmp/pip_build_root/ryu/setup.py) egg_info for package ryu    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'      warnings.warn(msg)    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'      warnings.warn(msg)        Installed /tmp/pip_build_root/ryu/pbr-5.1.3-py2.7.egg    [pbr] Processing SOURCES.txt    warning: LocalManifestMaker: standard file '-c' not found        warning: no previously-included files found matching '.gitignore'    warning: no previously-included files found matching '.gitreview'    warning: no previously-included files matching '*.pyc' found anywhere in distribution    warning: no previously-included files matching '*' found under directory 'doc/build'    warning: no previously-included files matching '*' found under directory 'ryu/tests/packet_data_generator'    warning: no previously-included files matching '*' found under directory 'ryu/tests/packet_data_generator2'    warning: no previously-included files matching '*~' found anywhere in distribution    warning: no previously-included files matching '*.pyc' found anywhere in distribution    warning: no previously-included files matching '.gitignore' found anywhere in distributionDownloading/unpacking eventlet>=0.18.2,!=0.18.3,!=0.20.1,!=0.21.0,!=0.23.0 (from ryu)  Downloading eventlet-0.24.1-py2.py3-none-any.whl (219kB): 219kB downloadedDownloading/unpacking msgpack>=0.3.0 (from ryu)  Downloading msgpack-0.6.1.tar.gz (118kB): 118kB downloaded  Running setup.py (path:/tmp/pip_build_root/msgpack/setup.py) egg_info for package msgpack    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'      warnings.warn(msg)    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'      warnings.warn(msg)    ...    Downloading/unpacking sortedcontainers (from ovs>=2.6.0->ryu)  Downloading sortedcontainers-2.1.0-py2.py3-none-any.whlDownloading/unpacking repoze.lru>=0.3 (from routes->ryu)  Downloading repoze.lru-0.7.tar.gz  Running setup.py (path:/tmp/pip_build_root/repoze.lru/setup.py) egg_info for package repoze.lru      Downloading pytz-2018.9-py2.py3-none-any.whl (510kB): 510kB downloadedInstalling collected packages: ryu, eventlet, msgpack, netaddr, oslo.config, ovs, routes, tinyrpc, webob, monotonic, dnspython, enum34, greenlet, oslo.i18n, stevedore, rfc3986, debtcollector, requests, PyYAML, sortedcontainers, repoze.lru, pbr, Babel, wrapt, funcsigs, idna, urllib3, certifi, chardet, pytz  Running setup.py install for ryu    [pbr] Generating AUTHORS    [pbr] AUTHORS complete (0.0s)    [pbr] Reusing existing SOURCES.txt    Installing ryu-manager script to /usr/local/bin    Installing ryu script to /usr/local/binCompiling /tmp/pip_build_root/eventlet/eventlet/green/http/client.py ...  File "/tmp/pip_build_root/eventlet/eventlet/green/http/client.py", line 195    _is_legal_header_name = re.compile(rb'[^:\s][^:\r\n]*\Z').match                                                           ^SyntaxError: invalid syntaxCompiling /tmp/pip_build_root/eventlet/eventlet/green/http/cookiejar.py ...  File "/tmp/pip_build_root/eventlet/eventlet/green/http/cookiejar.py", line 1269    yield from deepvalues(obj)             ^SyntaxError: invalid syntax  Running setup.py install for msgpack    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'long_description_content_type'      warnings.warn(msg)    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'project_urls'      warnings.warn(msg)    building 'msgpack._cmsgpack' extension    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -D__LITTLE_ENDIAN__=1 -I. -I/usr/include/python2.7 -c msgpack/_cmsgpack.cpp -o build/temp.linux-x86_64-2.7/msgpack/_cmsgpack.o    cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++ [enabled by default]    msgpack/_cmsgpack.cpp:4:20: fatal error: Python.h: No such file or directory     #include "Python.h"                        ^    compilation terminated.    WARNING: Failed to compile extension modules.    msgpack uses fallback pure python implementation.    command 'x86_64-linux-gnu-gcc' failed with exit status 1      Running setup.py install for ovs    building 'ovs._json' extension    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ovs/_json.c -o build/temp.linux-x86_64-2.7/ovs/_json.o    ovs/_json.c:1:20: fatal error: Python.h: No such file or directory     #include "Python.h"                        ^    compilation terminated.    ***************************************************************************    WARNING: The C extension could not be compiled, speedups are not enabled.    Failure information, if any, is above.    Retrying the build without the C extension.    ***************************************************************************      Running setup.py install for tinyrpc      Running setup.py install for greenlet    building 'greenlet' extension    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c greenlet.c -o build/temp.linux-x86_64-2.7/greenlet.o    In file included from greenlet.c:5:0:    greenlet.h:8:20: fatal error: Python.h: No such file or directory     #include 
^ compilation terminated. error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 Complete output from command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/greenlet/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_D5mAT-record/install-record.txt --single-version-externally-managed --compile: running installrunning buildrunning build_extbuilding 'greenlet' extensioncreating buildcreating build/temp.linux-x86_64-2.7x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c greenlet.c -o build/temp.linux-x86_64-2.7/greenlet.oIn file included from greenlet.c:5:0:greenlet.h:8:20: fatal error: Python.h: No such file or directory #include
^compilation terminated.error: command 'x86_64-linux-gnu-gcc' failed with exit status 1----------------------------------------Cleaning up...Command /usr/bin/python -c "import setuptools, tokenize;__file__='/tmp/pip_build_root/greenlet/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /tmp/pip-_D5mAT-record/install-record.txt --single-version-externally-managed --compile failed with error code 1 in /tmp/pip_build_root/greenletTraceback (most recent call last): File "/usr/bin/pip", line 9, in
load_entry_point('pip==1.5.4', 'console_scripts', 'pip')() File "/usr/lib/python2.7/dist-packages/pip/__init__.py", line 235, in main return command.main(cmd_args) File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 161, in main text = '\n'.join(complete_log)UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 42: ordinal not in range(128)

报错了,然后我运行了如下命令(上面的报错:缺少 python.h的解决办法是安装python-dev):

apt install libelf-dev python-dev dh-autoreconf

再次安装ryu:

pip install ryu

没有报错:

Requirement already satisfied (use --upgrade to upgrade): ryu in /usr/local/lib/python2.7/dist-packagesRequirement already satisfied (use --upgrade to upgrade): eventlet>=0.18.2,!=0.18.3,!=0.20.1,!=0.21.0,!=0.23.0 in /usr/local/lib/python2.7/dist-packages (from ryu)Requirement already satisfied (use --upgrade to upgrade): msgpack>=0.3.0 in /usr/local/lib/python2.7/dist-packages (from ryu)Requirement already satisfied (use --upgrade to upgrade): netaddr in /usr/local/lib/python2.7/dist-packages (from ryu)Requirement already satisfied (use --upgrade to upgrade): oslo.config>=2.5.0 in /usr/local/lib/python2.7/dist-packages (from ryu)Requirement already satisfied (use --upgrade to upgrade): ovs>=2.6.0 in /usr/local/lib/python2.7/dist-packages (from ryu)Requirement already satisfied (use --upgrade to upgrade): routes in /usr/local/lib/python2.7/dist-packages (from ryu)Requirement already satisfied (use --upgrade to upgrade): six>=1.4.0 in /usr/lib/python2.7/dist-packages (from ryu)Requirement already satisfied (use --upgrade to upgrade): tinyrpc in /usr/local/lib/python2.7/dist-packages (from ryu)Requirement already satisfied (use --upgrade to upgrade): webob>=1.2 in /usr/local/lib/python2.7/dist-packages (from ryu)Downloading/unpacking sortedcontainers (from ovs>=2.6.0->ryu)  Downloading sortedcontainers-2.1.0-py2.py3-none-any.whlInstalling collected packages: sortedcontainersSuccessfully installed sortedcontainersCleaning up...

但测试的时候报了错:

ryu-manager --help
Traceback (most recent call last):  File "/usr/local/bin/ryu-manager", line 5, in 
from pkg_resources import load_entry_point File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2749, in
working_set = WorkingSet._build_master() File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 444, in _build_master ws.require(__requires__) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 725, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 628, in resolve raise DistributionNotFound(req)pkg_resources.DistributionNotFound: repoze.lru>=0.3

然后我发现有一个库的名字就叫做repoze.lru,真是长见识了,安装这个库:

pip install repoze.lru

然后又报错如下:

Traceback (most recent call last):  File "/usr/local/bin/ryu-manager", line 5, in 
from pkg_resources import load_entry_point File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 2749, in
working_set = WorkingSet._build_master() File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 444, in _build_master ws.require(__requires__) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 725, in require needed = self.resolve(parse_requirements(requirements)) File "/usr/lib/python2.7/dist-packages/pkg_resources.py", line 628, in resolve raise DistributionNotFound(req)pkg_resources.DistributionNotFound: PyYAML>=3.12

安装这个库的时候又遇到了坑:

root@mininet-vm:/home/mininet# pip install PyYAMLDownloading/unpacking PyYAML  Downloading PyYAML-5.1.tar.gz (274kB): 274kB downloaded  Running setup.py (path:/tmp/pip_build_root/PyYAML/setup.py) egg_info for package PyYAML    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'      warnings.warn(msg)    Installing collected packages: PyYAML  Running setup.py install for PyYAML    /usr/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'python_requires'      warnings.warn(msg)    building '_yaml' extension    x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/python2.7 -c ext/_yaml.c -o build/temp.linux-x86_64-2.7/ext/_yaml.o    In file included from ext/_yaml.c:591:0:    ext/_yaml.h:2:18: fatal error: yaml.h: No such file or directory     #include 
^ compilation terminated. Error compiling module, falling back to pure Python Successfully installed PyYAMLCleaning up...

运行如下命令:

pip uninstall pyyamlapt-get install -y python-pip libpython-dev libyaml-dev libpython2.7-devpip install pyyaml

接下来就是一堆需要安装的库了:

pip install requests greenlet debtcollector rfc3986 stevedore

安装完后就可以使用ryu了:

root@mininet-vm:/home/mininet# ryu-manager --helpusage: ryu-manager [-h] [--app-lists APP_LISTS] [--ca-certs CA_CERTS]                   [--config-dir DIR] [--config-file PATH]                   [--ctl-cert CTL_CERT] [--ctl-privkey CTL_PRIVKEY]                   [--default-log-level DEFAULT_LOG_LEVEL] [--enable-debugger]                   [--explicit-drop] [--install-lldp-flow]                   [--log-config-file LOG_CONFIG_FILE] [--log-dir LOG_DIR]                   [--log-file LOG_FILE] [--log-file-mode LOG_FILE_MODE]                   [--noenable-debugger] [--noexplicit-drop]                   [--noinstall-lldp-flow] [--noobserve-links]                   [--nouse-stderr] [--nouse-syslog] [--noverbose]                   [--observe-links] [--ofp-listen-host OFP_LISTEN_HOST]                   [--ofp-ssl-listen-port OFP_SSL_LISTEN_PORT]                   [--ofp-switch-address-list OFP_SWITCH_ADDRESS_LIST]                   [--ofp-switch-connect-interval OFP_SWITCH_CONNECT_INTERVAL]                   [--ofp-tcp-listen-port OFP_TCP_LISTEN_PORT]                   [--pid-file PID_FILE] [--use-stderr] [--use-syslog]                   [--user-flags USER_FLAGS] [--verbose] [--version]                   [--wsapi-host WSAPI_HOST] [--wsapi-port WSAPI_PORT]                   [--test-switch-dir TEST-SWITCH_DIR]                   [--test-switch-interval TEST-SWITCH_INTERVAL]                   [--test-switch-target TEST-SWITCH_TARGET]                   [--test-switch-target-version TEST-SWITCH_TARGET_VERSION]                   [--test-switch-target_recv_port TEST-SWITCH_TARGET_RECV_PORT]                   [--test-switch-target_send_port_1 TEST-SWITCH_TARGET_SEND_PORT_1]                   [--test-switch-target_send_port_2 TEST-SWITCH_TARGET_SEND_PORT_2]                   [--test-switch-tester TEST-SWITCH_TESTER]                   [--test-switch-tester-version TEST-SWITCH_TESTER_VERSION]                   [--test-switch-tester_recv_port_1 TEST-SWITCH_TESTER_RECV_PORT_1]                   [--test-switch-tester_recv_port_2 TEST-SWITCH_TESTER_RECV_PORT_2]                   [--test-switch-tester_send_port TEST-SWITCH_TESTER_SEND_PORT]                   [--bgp-app-config-file BGP-APP_CONFIG_FILE]                   [--bgp-app-rpc-host BGP-APP_RPC_HOST]                   [--bgp-app-rpc-port BGP-APP_RPC_PORT]                   [--zapi-client-route-type ZAPI_CLIENT_ROUTE_TYPE]                   [--zapi-db-url ZAPI_DB_URL]                   [--zapi-frr-version ZAPI_FRR_VERSION]                   [--zapi-retry-interval ZAPI_RETRY_INTERVAL]                   [--zapi-router-id ZAPI_ROUTER_ID]                   [--zapi-server-host ZAPI_SERVER_HOST]                   [--zapi-server-port ZAPI_SERVER_PORT]                   [--zapi-server-version ZAPI_SERVER_VERSION]                   [app [app ...]]

转载地址:https://zhang0peter.blog.csdn.net/article/details/88576078 如侵犯您的版权,请留言回复原文章的地址,我们会给您删除此文章,给您带来不便请您谅解!

上一篇:anaconda下安装ffmpeg
下一篇:LeetCode 206 Reverse Linked List--反转链表--迭代与递归解法--递归使用一个临时变量,迭代使用3个

发表评论

最新留言

感谢大佬
[***.8.128.20]2024年04月21日 05时12分58秒

关于作者

    喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!

推荐文章

spring boot 与 Ant Design of Vue 实现角色管理布局以及角色的列表(十九) 2019-04-27
spring boot 与 Ant Design of Vue 实现新增角色(二十) 2019-04-27
spring boot 与 Ant Design of Vue 实现修改角色(二十一) 2019-04-27
spring boot 与 Ant Design of Vue 实现删除角色(补二十一) 2019-04-27
spring boot 与 Ant Design of Vue 实现组织管理布局的实现(二十二) 2019-04-27
spring boot 与 Ant Design of Vue 实现左侧组织树(二十三) 2019-04-27
spring boot 与 Ant Design of Vue 实现新增组织(二十四) 2019-04-27
spring boot 与 Ant Design of Vue 实现修改组织(二十五) 2019-04-27
spring boot 与 Ant Design of Vue 实现删除组织(二十六) 2019-04-27
spring boot 与 Ant Design of Vue 实现获取用户列表(二十七) 2019-04-27
spring boot 与 Ant Design of Vue 实现新增用户(二十八) 2019-04-27
spring boot 与 Ant Design of Vue 实现修改用户(二十九) 2021-06-30
spring boot 与 Ant Design of Vue 实现删除用户(三十) 2019-04-27
spring boot 与 Ant Design of Vue 鉴权体系登录的实现(三十一) 2019-04-27
spring boot 与 Ant Design of Vue 鉴权体系获取用户信息的实现(三十二) 2019-04-27
Druid连接池实现自定义场景的多数据库的连接 2019-04-27
CentOs7命令行(静默)的方式安装oracle数据库 2019-04-27
基于VMware安装CentOs7的镜像 2019-04-27
PL/SQL数据库管理工具的使用 2019-04-27
史上最简单的spring-boot集成websocket的实现方式 2019-04-27