Hello Rahul,
Actually, the question has been beyound the scope of support, but I can give you some links from internel on how to compile it .At first, you can use ARM compiler in NXP linux BSP for i.MX6 including Yocto, if you don't want, you can also download ARM cross-compiler from internel, and install it to ubuntu host.
(1)http://www.csce.uark.edu/~yfrancku/cross-python.html
(2)Cross-compiling Python for MIPS and ARM Platforms
There are many correponding links on your issue, you can try to search them !
Regards,
Weidong