I've installed python 2.7.13 from sources according to their readme file on CentOS 6.6. (just following the configure/make procedure). I run these python from the command line and seems to work fine. However, as it doesn't come with pip and setuptools, I downloaded get-pip.py and tried to run it this way:
/share/apps/Python-2.7.13/bin/python2.7 get-pip.py 
Then I get the following error:
Traceback (most recent call last):
  File "get-pip.py", line 28, in <module>
    import tempfile
  File "/share/apps/Python-2.7.13/lib/python2.7/tempfile.py", line 32, in <module>
    import io as _io
  File "/share/apps/Python-2.7.13/lib/python2.7/io.py", line 51, in <module>
    import _io
ImportError: /share/apps/Python-2.7.13/lib/python2.7/lib-dynload/_io.so: undefined symbol: _PyCodec_LookupTextEncoding
I tried the same with Python 2.7.12 with identical results.
However, if I run get-pip.py with a prebuilt python 2.7.12 release, it works fine.
EDIT: I checked the library /share/apps/Python-2.7.13/lib/python2.7/lib-dynload/_io.so with nm -g and the symbol seems to be there (I found         U _PyCodec_LookupTextEncoding)
Any help will be greatly appreciated,
thanks in advance,
Bernabé
After digging a bit more, I found the problem.
The symbol was undefined in _io.so.  I ldd this library and learned that it was pointing to an older libpython2.7.so (which is the library that happens to define the symbol in its new version). This was because I had the old /opt/python/lib in my LDD_LIBRARY_PATH:
linux-vdso.so.1 =>  (0x00007fffb68d5000)
        libpython2.7.so.1.0 => /opt/python/lib/libpython2.7.so.1.0 (0x00007f4240492000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x00007f424025f000)
        libc.so.6 => /lib64/libc.so.6 (0x00007f423fecb000)
        libdl.so.2 => /lib64/libdl.so.2 (0x00007f423fcc7000)
        libutil.so.1 => /lib64/libutil.so.1 (0x00007f423fac3000)
        libm.so.6 => /lib64/libm.so.6 (0x00007f423f83f000)
        /lib64/ld-linux-x86-64.so.2 (0x000000337b000000)

I fixed this and it solved the problem.
Undefined symbol after Running get-pip on fresh Python source installation