File size: 1,245 Bytes
9273228
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
orphan

:   

# How to port Python 2 Code to Python 3 {#pyporting-howto}

author
:   Brett Cannon

Python 2 reached its official end-of-life at the start of 2020. This means that no new bug reports, fixes, or changes will be made to Python 2 - it\'s no longer supported: see `373`{.interpreted-text role="pep"} and [status of Python versions](https://devguide.python.org/versions).

If you are looking to port an extension module instead of pure Python code, please see `cporting-howto`{.interpreted-text role="ref"}.

The archived [python-porting](https://mail.python.org/pipermail/python-porting/) mailing list may contain some useful guidance.

Since Python 3.11 the original porting guide was discontinued. You can find the old guide in the [archive](https://docs.python.org/3.10/howto/pyporting.html).

## Third-party guides

There are also multiple third-party guides that might be useful:

- [Guide by Fedora](https://portingguide.readthedocs.io)
- [PyCon 2020 tutorial](https://www.youtube.com/watch?v=JgIgEjASOlk)
- [Guide by DigitalOcean](https://www.digitalocean.com/community/tutorials/how-to-port-python-2-code-to-python-3)
- [Guide by ActiveState](https://www.activestate.com/blog/how-to-migrate-python-2-applications-to-python-3)