ubuntu18.04下2to3将python2代码升级为python3-20200623

之前试过windows下2to3,类似一键将Python2代码自动转化为Python3

ubuntu18.04下,在conda的envs下,2to3报错

bash: /home/czey/anaconda3/envs/tf/bin/2to3-3.6: /home/czey/anaconda3/envs/tensorflow/bin/python: bad interpreter: No such file or directory

之前安装的tensorflow删掉了

sudo apt install 2to3
conda deactivate
2to3 -f all -f idioms xxx.py或文件夹 -w

再借助Ubuntu系统python2代码转化为python3代码(2to3)
conda deactivate之后运行,成功!

你可能感兴趣的:(ubuntu)