1

I just downloaded Python sources, unpacked them to /usr/local/src/Python-3.5.1/, run ./configure and make there. Now, according to documentation, I should run make install.

But I don't want to install it somewhere in common system folders, create any links, change or add environment variables, doing anything outside this folder. In other words, I want it to be portable. How do I do it? Will /usr/local/src/Python-3.5.1/python get-pip.py install Pip to /usr/local/src/Python-3.5.1/Lib/site-packages/? Will /usr/local/src/Python-3.5.1/python work properly?

make altinstall, as I understand, still creates links what is not desired. Is it correct that it creates symbolic links as well but simply doesn't touch /usr/bin/python and man?

Probably, I should do ./configure prefix=some/private/path and just make and make install but I still wonder if it's possible to use Python make install.

4
  • none of these commands will actually touch /usr/bin/python. As far as I have used them they create a new symlink /usr/bin/python35 Commented Apr 17, 2016 at 6:06
  • @SiddharthGupta Thanks for insight! Indeed, /usr/bin/python won't probably be touched but I don't want /usr/bin/python35 to be touched either. Commented Apr 17, 2016 at 6:08
  • 1
    If you're on Linux, you could leverage containers for a portable "sand box" of python. The most widely known tool set for this is docker, and it already has officially supported Python containers Commented Apr 17, 2016 at 6:28
  • @willnx Indeed, sandboxes and VMs may serve this purpose. But my question is still valid since I also have some interest. Commented Apr 17, 2016 at 6:32

1 Answer 1

1

If you don't want to copy the binaries you built into a shared location for system-wide use, you should not make install at all. If the build was successful, it will have produced binaries you can run. You may need to set up an environment for making them use local run-time files instead of the system-wide ones, but this is a common enough requirement for developers that it will often be documented in a README or similar (though as always when dealing with development sources, be prepared that it might not be as meticulously kept up to date as end-user documentation in a released version).

Sign up to request clarification or add additional context in comments.

1 Comment

I purposely left this general enough to cover the common case, not just Python.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.