Why aren't pip-installed executables available from the command line?

11,887

There is no virtualenv-tools executable in the virtualenv-tools package, that's why you cannot execute it. It contains a script called virtualenv, which you should be able to execute. Read the documentation on how to use it first:

Virtualenv has one basic command:

$ virtualenv ENV

Anyway, in general, when you install a package using pip and it contains an executable script, it's put into the directory which should be in the PATH environment variable to be able to execute it from anywhere. This directory depends on the system used:

  • Linux: /usr/bin
  • Mac: /usr/local/bin (when Homebrew Python is used)
  • Windows: <python_directory>/Scripts

So first, make sure the directory is in PATH (this is mainly an issue on Windows; Linux and Mac have it by default). Second, check if the script is in the directory and is executable.

Also, many packages are just libraries without any executable, so you should always read the package documentation first to find out how to use it.

Share:
11,887

Related videos on Youtube

lindelof
Author by

lindelof

Updated on September 18, 2022

Comments

  • lindelof
    lindelof over 1 year

    I've installed Python with Homebrew. I would like to use pip to install additional packages, some of which come with executables that are meant to be called from the command line, for example crossbar or virtualenv-tools.

    But this doesn't work and I don't know why:

    $ pip install virtualenv-tools
    Requirement already satisfied: virtualenv-tools in /usr/local/lib/python2.7/site-packages
    $ virtualenv-tools
    -bash: virtualenv-tools: command not found
    $ find /usr/ -name virtualenv-tools
    /usr//local/Cellar/python/2.7.13/Frameworks/Python.framework/Versions/2.7/bin/virtualenv-tools
    

    So pip correctly installed the virtualenv-tools package, including the executable, but somehow doesn't make this executable available to the command line.

    Am I missing something here?

  • slhck
    slhck about 7 years
    While macOS is Unix, Homebrew does not use /usr/bin. It uses /usr/local/bin instead.
  • lindelof
    lindelof about 7 years
    The virtualenv-tools package is not the same as the virtualenv package, and does indeed provide a virtualenv-tools executable: pypi.python.org/pypi/virtualenv-tools. I have the same problem with installing crossbar with pip install crossbar: the crossbar executable is not available from the command line.
  • WestCoastProjects
    WestCoastProjects about 2 years
    "when you install a package using pip and it contains an executable script" . How do we tell pip to do that?