The ‘3to2’ refer below:
Install ‘3to2’ package in your python 3 env.
Note! Attention! Please!
If you installed python2 and python3.
pip3 install 3to2
pip default using version is python2.
pip3 is using for python3.
pip3 install 3to2 will be recommended, while your system have to version of python 2 and 3.
Because 3to2 only run in python version > 3.x
Because of this reason, I met the some frustation. So, that’s all.
You can get the file
3to2 from https://bitbucket.org/amentajo/lib3to2/src/default/.
Or create a file
3to2 at the folder you want to porting you code from python3 to python2.
The code of 3to2 is below:
from lib3to2.main import main
Then, run like this to cover the python3 code to python2:
python3 ./3t upload.python2.py -w
-w: means write the change to current file,and make a bak file at the same folder sametime.
- System: Kali(debian 8)
- python: 3.6 and 2.7