Pip borks the #! line when installing pylint from Python sandbox

Skip Montanaro skip.montanaro at gmail.com
Thu Mar 5 11:14:52 EST 2020


I originally sent this to the code-quality list, but in retrospect (and
considering the crickets), I think c.l.py would have been a better starting
point.

------------------------------------------------

I'm working on Python from GitHub, so have a fork which I check out
and keep synced with the main repo. I run pylint on my code (which is
nominally aimed at finding its way into Python someday), so installed
it using pip:

./python -m pip install --user pylint

(I prefer to tie pylint to the Python version I'm working on, if for
no other reason than that as Python 3.9alpha moves along, this might
flag something needing the Pylint team's attention.) This downloads
whatever is necessary and installs it. Unfortunately, instead of
creating a #! line of something like

#!/home/skip/src/python/cpython/python

it generates

#!/usr/local/bin/python3.9

I didn't specify any sort of --prefix location when I configured, as I
don't intend to install the code I'm working on. Mostly I just run
"make test." I saw nothing like an --inplace flag in either Python's
configure or pip's help output. It's not at all clear that I should
give --prefix=$(pwd) to pip as I think that would install all
subsidiary modules (pylint, astroid, etc) inside my Python sandbox. Is
there some way coax pip into referencing my sandbox python executable,
or will I be forced to edit the relevant command scripts once they are
installed in ~/.local/bin?

Thanks,

Skip Montanaro


More information about the Python-list mailing list