How to use python2 module in python3? | Sololearn: Learn to code for FREE!


How to use python2 module in python3?

i found a module package that is written in python 2.7 and don't support python3. how can i use it in python3? is there any middle module to use the original code yet? or i should convert all package codes from py2 to py3?

4/6/2018 7:34:09 PM


3 Answers

New Answer


Is your project already written in Python 3? If it isn't, you should consider using Python 2.7 with __future__ imports, or trying another library. You could convert all to Python 3, and you would have to store the library code in your project, or make a script to adapt the library automatically, or yet making your Own module on PIP. I don't think of them as good ideas.


You're always welcome. Cool you're considering my idea :)


thanks maicon i afraid of converting the library and miss some features. i think your first idea is better one.