前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >mininet部署记录

mininet部署记录

原创
作者头像
用户9805946
发布2024-11-13 10:00:43
发布2024-11-13 10:00:43
930
举报

1. 参考文章

https://mininet.org/download/

本文采用下载源码的方式安装

2. 从github下载源码

代码语言:shell
复制
git clone git@github.com:mininet/mininet.git

推荐使用git协议clone,否则会有下载失败的可能

代码语言:shell
复制
fatal: unable to access 'https://github.com/mininet/mininet/': Failed to connect to github.com port 443 after 75003 ms: Couldn't connect to server

3选择合适的版本

代码语言:bash
复制
cd mininet
git tag  # list available versions
git checkout -b mininet-2.3.0 2.3.0  # 也可以选择其他版本
cd ..

4. Python环境准备

创建虚环境

代码语言:bash
复制
cd ~
virtualenv ~/.venv
source ~/.venv/bin/activate

可以把source放到 ~/.bashrc里

代码语言:bash
复制
cat >>~/.bashrc <<EOF
# active python3 virtualenv
source ~/.venv/bin/activate
EOF

4. 执行安装

代码语言:bash
复制
mininet/util/install.sh -a # 完整模式,也可以选择其他模式, 可以 -h 查看选项

问题记录

错误1

代码语言:bash
复制
Installing Mininet core
~/mininet ~/mininet
cc -Wall -Wextra  \
-DVERSION=\"`PYTHONPATH=. python -B bin/mn --version 2>&1`\" mnexec.c -o mnexec
<command-line>: warning: missing terminating " character
mnexec.c: In function ‘main’:
<command-line>: error: missing terminating " character
mnexec.c:208:28: note: in expansion of macro ‘VERSION’
  208 |             printf("%s\n", VERSION);
      |                            ^~~~~~~
mnexec.c:208:35: error: expected expression before ‘)’ token
  208 |             printf("%s\n", VERSION);
      |                                   ^
make: *** [Makefile:50: mnexec] Error 1

编译使用了python命令,但是环境只有python3, 没有python 命令,通过添加python软连接解决

代码语言:bash
复制
ln -s /usr/bin/python3 /usr/bin/python

问题2

代码语言:bash
复制
python -m pip install .
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
    python3-xyz, where xyz is the package you are trying to
    install.

    If you wish to install a non-Debian-packaged Python package,
    create a virtual environment using python3 -m venv path/to/venv.
    Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
    sure you have python3-full installed.

    If you wish to install a non-Debian packaged Python application,
    it may be easiest to use pipx install xyz, which will manage a
    virtual environment for you. Make sure you have pipx installed.

    See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.
make: *** [Makefile:62: install] Error 1

编辑mininet/Makefile 第62行,增加 --break-system-packages

代码语言:diff
复制
diff --git a/Makefile b/Makefile
index 0fb1f84..7934575 100644
--- a/Makefile
+++ b/Makefile
@@ -59,7 +59,7 @@ install-manpages: $(MANPAGES)
 install: install-mnexec install-manpages
 #      This seems to work on all pip versions
        $(PYTHON) -m pip uninstall -y mininet || true
-       $(PYTHON) -m pip install .
+       $(PYTHON) -m pip install . --break-system-packages

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。

如有侵权,请联系 cloudcommunity@tencent.com 删除。

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 1. 参考文章
  • 2. 从github下载源码
  • 3选择合适的版本
  • 4. Python环境准备
  • 4. 执行安装
  • 问题记录
    • 错误1
    • 问题2
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档