When I write a python tool in Pro it uses python 3
When I share it (as service or package) the server uses python 2.
What happens if I need to use python 3 functions or libraries?
see similar question here: https://gis.stackexchange.com/questions/268056/run-python-3-scripts-on-arcgis-server-10-5
don't know since I don't work in that environment, but there are documents and there is an anaconda distribution
based on python 3
Thanks for the answer but let me clarify my question.
I build a GP tool in Pro uses python 3 (this is what is used for pro).
It is not in anaconda it is GP tool.
Then I pack or publish it for the server.
Check this: https://support.esri.com/en/technical-article/000013224 The server use python 2 to run a tool that was written in python 3.
It is almost identical but still there is a few things in python 3 that will not work in python 2.
Sorry, I haven't used 2.7 in so long I can't remember which python modules or python functionality changed between the two ( like the obvious print, range etc)
Support for 2.7 is being dropped by a lot of things already or soon (ie numpy, scipy, pandas etc).
A specific example would help of what you are missing or what behaves differently to see if there is a simple workaround. Anything on GitHub is pretty easy to get version different code (I do it all the time with numpy when ArcGIS distributed packages lag behind current needs or you want to support arcmap)