Skip to main content

Cross-platform tool for adding locations to the user PATH, no elevated privileges required!

Project description

CI - Travis CI - AppVeyor Codecov

PyPI - Supported Python versions PyPI - Version PyPI - Downloads

License: MIT/Apache-2.0 Say Thanks

Ever wanted to release a cool new app but found it difficult to add its location to PATH for users? Me too! This tool does that for you on all major operating systems and does not require elevated privileges!

Fear not, this only modifies the user PATH; the system PATH is never touched nor even looked at!


userpath is distributed on PyPI as a universal wheel and is available on Linux/macOS and Windows and supports Python 2.7/3.6+ and PyPy.

$ pip install userpath


Only 3!

$ userpath -h
Usage: userpath [OPTIONS] COMMAND [ARGS]...

  --version   Show the version and exit.
  -h, --help  Show this message and exit.

  append   Appends to the user PATH
  prepend  Prepends to the user PATH
  verify   Checks if locations are in the user PATH
Example run


>>> import userpath
>>> location = r'C:\Users\Ofek\Desktop\test'
>>> userpath.in_current_path(location)
>>> userpath.in_new_path(location)
>>> userpath.append(location)
>>> userpath.in_new_path(location)
>>> userpath.need_shell_restart(location)


userpath is distributed under the terms of both

at your option.


Important changes are emphasized.


  • Fix fallback mechanism for detecting the name of the parent process


  • Fix PATH registry key type on Windows


  • Fix duplicating system paths on Windows
  • Prevent adding paths multiple times on macOS/Linux
  • Send CLI errors to stderr instead of stdout


  • Only require the dependency distro on Linux
  • Ship tests with source distributions


  • Added support for shell auto-detection and selection


  • First public stable release

View all history

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for userpath, version 1.4.2
Filename, size File type Python version Upload date Hashes
Filename, size userpath-1.4.2-py2.py3-none-any.whl (14.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View
Filename, size userpath-1.4.2.tar.gz (20.1 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page