2

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?

3

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.

| improve this answer | |
  • 1
    While macOS is Unix, Homebrew does not use /usr/bin. It uses /usr/local/bin instead. – slhck Apr 28 '17 at 14:28
  • 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. – lindelof May 1 '17 at 7:24

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.