1, How to check the python version
import sys
if sys.version_info < ( 3.0 )
print ( "python version is 2.x" )
else :
print ( "python version is 3.x" )
|
2, How to change the default python version
sudo rm /usr/bin/python
sudo ln -s /usr/bin/python3.5 /usr/bin/python
|
3, How to install python3.x package
sudo apt install python3 -pip
sudo pip3 install package
|
4,Auto update python2.x to python3.x
http://python-future.org/futurize.html#forwards-conversion
http://python-future.org/automatic_conversion.html
4.1 Install future
4.2 execute cmd
futurize --stage1 -w **/*.py
futurize --stage2 -w **/*.py
|
or
5, Changed lib