[Python-ideas] Adding Python interpreter info to "pip install"

Wes Turner wes.turner at gmail.com
Fri Jul 20 01:26:56 EDT 2018


`python -m site` and its docs may also be useful for troubleshooting
end-user installations.

A diagnostic script with e.g. these commands could also be helpful:

which python
which pip
python -m site  # sys.path, USER_SITE (pip --user)
python -m pip --version

>>> print((os.name, sys.platform, platform.system()))


https://docs.python.org/3/library/site.html

"""
The site module also provides a way to get the user directories from the
command line:

$ python3 -m site --user-site
/home/user/.local/lib/python3.3/site-packages

If it is called without arguments, it will print the contents of sys.path
on the standard output, followed by the value of USER_BASE and whether the
directory exists, then the same thing for USER_SITE, and finally the value
of ENABLE_USER_SITE.

--user-base

Print the path to the user base directory.

--user-site

Print the path to the user site-packages directory.

If both options are given, user base and user site will be printed (always
in this order), separated by os.pathsep.

If any option is given, the script will exit with one of these values: O if
the user site-packages directory is enabled, 1 if it was disabled by the
user, 2 if it is disabled for security reasons or by an administrator, and
a value greater than 2 if there is an error.
"""


On Friday, July 20, 2018, Nathaniel Smith <njs at pobox.com> wrote:

> On Thu, Jul 19, 2018 at 5:45 PM, Al Sweigart <asweigart at gmail.com> wrote:
> > The goal of this idea is to make it easier to find out when someone has
> > installed packages for the wrong python installation. I'm coming across
> > quite a few StackOverflow posts and emails where beginners are using pip
> to
> > install a package, but then finding they can't import it because they
> have
> > multiple python installations and used the wrong pip.
>
> This sounds like a great idea to me, but pip is developer separately
> from python itself, and I don't think the pip maintainers monitor
> python-ideas. I'd suggest filing a feature request on the pip tracker:
>
> https://github.com/pypa/pip/issues/new?template=feature-request.md
>
> -n
>
> --
> Nathaniel J. Smith -- https://vorpus.org
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180720/2fb187f8/attachment.html>


More information about the Python-ideas mailing list