Skip to content
Advertisement

Move python folder on linux

I have compiled python sources with the --prefix option. After running make install the binaries are copied to a folder of my account’s home directory.

I needed to rename this folder but when I use pip after the renaming it says that it can’t find the python interpreter. It shows an absolute path to the previous path (before renaming).

Using grep I found out multiple references to absolute paths relative to the --prefix folder.

I tried to override it by setting the PATH,PYTHONPATH and PYTHONHOME environment variables but it’s not better.

Is there a way to compile the python sources in a way that I can freely moves it after ?

Advertisement

Answer

Pip is a python script. Open it and see :

it begins with #!/usr/bin/python

You can either create a symbolic link in the old path to point to the new one, or replace the shebang with the new path. You can also keep your distrib interpreter safe by leaving it be and set the compiled one into a new virtualenv.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement