Skip to content

Commit d163acc

Browse files
jwoddertheacodes
authored andcommitted
Move note on PATH to --user installs section (pypa#551)
* Move note on PATH to --user installs section * Address review comments
1 parent 744cf40 commit d163acc

File tree

2 files changed

+28
-18
lines changed

2 files changed

+28
-18
lines changed

source/tutorials/installing-packages.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,6 +303,7 @@ Upgrade an already installed `SomeProject` to the latest from PyPI.
303303
pip install --upgrade SomeProject
304304

305305

306+
.. _`Installing to the User Site`:
306307

307308
Installing to the User Site
308309
===========================
@@ -322,6 +323,32 @@ from the pip docs.
322323
Note that the ``--user`` flag has no effect when inside a virtual environment
323324
- all installation commands will affect the virtual environment.
324325

326+
If ``SomeProject`` defines any command-line scripts or console entry points,
327+
``--user`` will cause them to be installed inside the `user base`_'s binary
328+
directory, which may or may not already be present in your shell's
329+
:envvar:`PATH`. (Starting in version 10, pip displays a warning when
330+
installing any scripts to a directory outside :envvar:`PATH`.) If the scripts
331+
are not available in your shell after installation, you'll need to add the
332+
directory to your :envvar:`PATH`:
333+
334+
- On Linux and macOS you can find the user base binary directory by running
335+
``python -m site --user-base`` and adding ``bin`` to the end. For example,
336+
this will typically print ``~/.local`` (with ``~`` expanded to the absolute
337+
path to your home directory) so you'll need to add ``~/.local/bin`` to your
338+
``PATH``. You can set your ``PATH`` permanently by `modifying ~/.profile`_.
339+
340+
- On Windows you can find the user base binary directory by running ``py -m
341+
site --user-site`` and replacing ``site-packages`` with ``Scripts``. For
342+
example, this could return
343+
``C:\Users\Username\AppData\Roaming\Python36\site-packages`` so you would
344+
need to set your ``PATH`` to include
345+
``C:\Users\Username\AppData\Roaming\Python36\Scripts``. You can set your user
346+
``PATH`` permanently in the `Control Panel`_. You may need to log out for the
347+
``PATH`` changes to take effect.
348+
349+
.. _user base: https://docs.python.org/3/library/site.html#site.USER_BASE
350+
.. _modifying ~/.profile: https://stackoverflow.com/a/14638025
351+
.. _Control Panel: https://msdn.microsoft.com/en-us/library/windows/desktop/bb776899(v=vs.85).aspx
325352

326353
Requirements files
327354
==================

source/tutorials/managing-dependencies.rst

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -44,29 +44,12 @@ Use ``pip`` to install Pipenv:
4444
.. Note:: This does a `user installation`_ to prevent breaking any system-wide
4545
packages. If ``pipenv`` isn't available in your shell after installation,
4646
you'll need to add the `user base`_'s binary directory to your ``PATH``.
47-
48-
On Linux and macOS you can find the user base binary directory by running
49-
``python -m site --user-base`` and adding ``bin`` to the end. For example,
50-
this will typically print ``~/.local`` (with ``~`` expanded to the
51-
absolute path to your home directory) so you'll need to add
52-
``~/.local/bin`` to your ``PATH``. You can set your ``PATH`` permanently by
53-
`modifying ~/.profile`_.
54-
55-
On Windows you can find the user base binary directory by running
56-
``py -m site --user-site`` and replacing ``site-packages`` with
57-
``Scripts``. For example, this could return
58-
``C:\Users\Username\AppData\Roaming\Python36\site-packages`` so you would
59-
need to set your ``PATH`` to include
60-
``C:\Users\Username\AppData\Roaming\Python36\Scripts``. You can set your
61-
user ``PATH`` permanently in the `Control Panel`_. You may need to log
62-
out for the ``PATH`` changes to take effect.
47+
See :ref:`Installing to the User Site` for more information.
6348

6449
.. _npm: https://www.npmjs.com/
6550
.. _bundler: http://bundler.io/
6651
.. _user base: https://docs.python.org/3/library/site.html#site.USER_BASE
6752
.. _user installation: https://pip.pypa.io/en/stable/user_guide/#user-installs
68-
.. _modifying ~/.profile: https://stackoverflow.com/a/14638025
69-
.. _Control Panel: https://msdn.microsoft.com/en-us/library/windows/desktop/bb776899(v=vs.85).aspx
7053

7154
Installing packages for your project
7255
------------------------------------

0 commit comments

Comments
 (0)