Fusion
Fusion

Reputation: 5462

Run pip package via absolute path

On my Ubuntu 18.04.1 LTS I have installed pipenv package using pip package manager. Package is accessible from ssh login bash.

$ pipenv --version

will print out following output:

pipenv, version 2018.10.13

What want:

I need to run $ pipenv --version command using absolute path. So This is how it should look like:

$ /absolute/path/to/pipenv --version

However so far it looks like it does not work by this way.

What I tried:

$ pip show pipenv

Name: pipenv

Version: 2018.10.13

Location: /user/.local/lib/python2.7/site-packages

Requires: enum34, virtualenv, typing, certifi, virtualenv-clone, pip, setuptools

...

I copied location from output above, and I tried these, but still does not work:

I also tried:

which pipenv - outputs empty string

Upvotes: 3

Views: 1343

Answers (1)

hoefling
hoefling

Reputation: 66181

Recapping the comments, if pipenv command is available, you can:

  1. run command -v pipenv or which pipenv if pipenv is an executable in PATH
  2. run type pipenv if pipenv is an alias or a function

If the command is not available, you can extract the info about the executable from the package metadata: run

$ pip show -f pipenv

to list the files belonging to the pipenv package (If the output is empty, it means that pipenv is not installed for the Python version pip refers to). Among other things, it will print you the package location, similar to

Location: /Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages

and with other files, the executable:

../../../bin/pipenv

This is the path relative to the Location above - the resolved path leads you to the executable file.

Upvotes: 2

Related Questions