How to install/uninstall python 3.x to specific path?

7,097

Download and extract the source code from here. Open a terminal in the directory where you extracted the code.

./configure --prefix=/directory/to/install
make
sudo make install

Refer to ./configure --help for full details. If you want to install different python versions at the same time, use make altinstall or --exec-prefix option.

To uninstall the previous version that you installed with make, you could try to find and delete all the python directories in /usr/local or use checkinstall (recommended) to make a deb package to reinstall and uninstall:

sudo apt-get install checkinstall
cd /path/to/python/source
./configure
sudo checkinstall -D --fstrans=no make install
sudo dpkg -i Python-3.5.2.deb
sudo dpkg -r Python-3.5.2
Share:
7,097

Related videos on Youtube

Giorgi
Author by

Giorgi

I'm a mathematician. I've been actively using LaTeX since 2012. LaTeX allows me to make many high quality documents.

Updated on September 18, 2022

Comments

  • Giorgi
    Giorgi almost 2 years

    I've installed python 3.5.2 on my system, but it was divided between folders in /usr/local, some went to lib, some to bin. I know why this is for packages, which are installed by apt-get, but I would prefer to install packages (which are not from package manager) to one directory.

    Can this be done? And how can we properly uninstall this kind of packages?

    Note:
    when I installed textlive2015, from the tug.org it all installed in one directory /usr/local/texlive.

    • Giorgi
      Giorgi almost 8 years
      downloaded from python.org the package, unpacked, run ./configure, make install
  • Giorgi
    Giorgi almost 8 years
    I think it will work, but how do I uninstall the one which is already installed?
  • Paul Nordin
    Paul Nordin almost 8 years
    I have updated the answer to include uninstall information.