ryu、python安装、版本问题

conda

jsx 复制代码
conda create --name py35 python=3.5 创建
conda  activate py35 //激活
conda deactivate py35//退出
conda remove --name py35 --all//移除
conda info -e //已安装环境

/miniconda3/bin/python  base位置

/etc/python /usr/lib/python3.5m

/usr/bin/python2.7 mininet位置

python2到python3变化

1.AttributeError: 'dict' object has no attribute 'has_key':

jsx 复制代码
if not my_dict.has_key(my_key):
改法1 if my_key not in my_dict:
改法2 if my_dict.get(my_key) is not None:

2.TypeError: 'float' object cannot be interpreted as an integer

原因:在python2,'/' 只留下了整数部分,去掉了小数,是int型。而在 python3里,'/' 的结果是真正意义上的除法,结果是float型。所以便出现了该问题;'//'才是python3中结果为整数的除法。

jsx 复制代码
/改成//

3.路径问题-traffic.py799行,改成traffic.npy的路径。

pip

/home/chen/.local/lib/python3.5/site-packages/pip (python 3.5)

不小心把pip删掉的原因导致的,所以需要重新配置一下。先执行下面命令。

jsx 复制代码
which pip
type pip
hash -r
pip --version
-i https://pypi.tuna.tsinghua.edu.cn/simple

阿里云 http://mirrors.aliyun.com/pypi/simple/ 
  中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 
  豆瓣(douban) http://pypi.douban.com/simple/ 
  清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 
  中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple //换源

from pip._internal.cli.main import main

ImportError: No module named _internal.cli.main

jsx 复制代码
sudo apt remove python-pip 执行前确保你的python和pip是同一个python环境
https://bootstrap.pypa.io/pip/2.7/get-pip.py 下载后保存
python get-pip.py --user

tensorboard-data-server==0.6.1
tensorflow-io-gcs-filesystem
tomli

ryu

python2.7安装时报错error: could not create '/usr/local/lib/python2.7/dist-packages/ryu': Permission denied

jsx 复制代码
sudo chown -R $USER /usr/local 获取权限
python setup.py install
相关推荐
许彰午6 小时前
100_Python面试常见问题汇总
java·python·面试
皓悦编程记6 小时前
【YOLO26 系列】基于YOLO26的垃圾分类检测系统【python源码+Pyqt5界面/WEB+数据集+训练代码】
python·qt·分类
滴滴滴嘟嘟嘟.6 小时前
强化学习消融实验-batch_size / clip_range / gae_lambda / lr
python·机器学习
2601_963932986 小时前
怀孕四个月能做流产吗?中期妊娠终止方式与子宫修护科普指南
python
zhr_math_king6 小时前
LangGraph-快速入门-第一个例子
python·langchain
爱吃苹果的梨叔7 小时前
2026年指挥中心分布式坐席怎么选?清虹创智让多系统、多坐席和大屏真正协同
python
没钥匙的锁17 小时前
16-Java反射机制:Spring IOC背后的核心技术
java·开发语言·spring
起予者汝也8 小时前
Python 数据结构
开发语言·数据结构·python
LadenKiller8 小时前
2026年量化工具增量,放回回测模拟实盘阶段判断
人工智能·python
石一峰6998 小时前
驱动:私有数据为什么要在三个地方各挂一遍?
数据库·python·算法