I'm trying to install the latest Python version on my workstation at work. Unfortunately I don't have root access, and they won't do it for me, so I have to compile from source and put it in ~/local/bin.

I've downloaded the source, and run ./configure --prefix=~/local && make && make install. However, I get an error that says ModuleNotFoundError: No module named '_ctypes' when it tries to install pip.

According to here: https://stackoverflow.com/questions/54094550/linux-modulenotfounderror-no-module-named-ctypes

I need to install libffi-dev. So I downloaded the source and ran ./configure --prefix=~/local && make && make install there.

Now my problem is that it installed the .so files in ~/local/lib64, and the installer tells me I need to link against the library by using libtool or the LD_LIBRARY_PATH env var or some linker flags.

I need to run the python make but it needs to point to both that library directory and the default one. I can't seem to figure out how to do it because none of the options suggested are working.


  • Check out the answer in the linked question for a working set of env vars you need to adjust before compiling Python. – hoefling Feb 13 at 9:56

Browse other questions tagged or ask your own question.