I'm trying to install python3 for one of remote hosting over ssh. I don't have root access. Installation was done with:
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tgz tar xvzf Python-3.4.3.tgz ./configure --prefix=$HOME/.local make make install
This installs Python 3, however in the end of installation this error occurs:
File "/home/someusername/Python-3.7.0/Lib/ctypes/__init__.py", line 7, in <module> from _ctypes import Union, Structure, Array ModuleNotFoundError: No module named '_ctypes'
python3 is installed, but pip install failed. After some research it seems that libffi is missing. After using wget to obtain libffi-3.2.1, it is installed with:
./configure --prefix=$HOME/.local make make install
This shows it is installed:
someusername@a2plcpnl079 [~/.local/lib]$ ls ./ ../ libffi-3.2.1/ libpython3.7m.a* pkgconfig/ python3.7/ someusername@a2plcpnl079 [~/.local/lib]$ cd libffi-3.2.1/ someusername@a2plcpnl079 [~/.local/lib/libffi-3.2.1]$ ls ./ ../ include/ someusername@a2plcpnl079 [~/.local/lib/libffi-3.2.1]$ cd include someusername@a2plcpnl079 [~/.local/lib/libffi-3.2.1/include]$ ls ./ ../ ffi.h ffitarget.h someusername@a2plcpnl079 [~/.local]$ cd lib64 someusername@a2plcpnl079 [~/.local/lib64]$ ls ./ ../ libffi.a libffi.la* libffi.so@ libffi.so.6@ libffi.so.6.0.4*
Now it is necessary to reconfigure the build of python-3.7.0 so it uses the local libffi. I tried a number of variations but still can't install pip.
# .bash_profile # Get the aliases and functions if [ -f ~/.bashrc ]; then . ~/.bashrc fi # User specific environment and startup programs PATH=$PATH:$HOME/.local/bin:$HOME/bin export PATH export HISTTIMEFORMAT="%d/%m/%y %T " export PATH="$HOME/.local/bin:$PATH" export LD_LIBRARY_PATH=$HOME/.local/lib64
Something like this was attempted:
$ ./configure --with-system-ffi --prefix=$HOME/.local LDFLAGS="-L/home/someusername/.local/lib64" LIBS="-L/home/someusername/.local/lib"
The same error occurred, so the question is how to correctly invoke Python-3.7.0 configure to use the local libffi library in order to fully install python?