M BUZZ CRAZE NEWS
// news

Pip: installing a newer module version with `--user` option

By Emma Johnson

Scenario:

A python package abc is installed as a system package e.g. to /usr/lib or /usr/local/... (either as sudo pip install abc or via the system package manager).

A higher version of the abc package is installed with pip as a user package: pip install abc --user.

Which version will be effective for that specific user? (ie when a script contains import abc)

1 Answer

Whichever one is in the users $PATH.

which abc will show you which one will run, if you simply ran abc.

echo $PATH will show, in order, the directories that will be checked for the executable with the first location it's found, being used.

If you're within a pipenv then this may modify the behaviour, but the above statements still stand, you just might find you have a different $PATH.

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy