Trouble with Installing 'pipenv' on macOS Terminal

Terminal in macOS is stating that I’ve already installed ‘pip3’ (v 21.3.1).

When I try installing ‘pipenv’, it says ‘Requirement already satisfied: pipenv in ./Library/Python/3.8/lib/python/site-packages’; however, if I type ‘pipenv’ into the terminal, it says ‘command not found: pipenv’.

For the Python3 course, we are currently learning about virtual environments; but I don’t have a lot of terminal experience and starting to feel out of my depth.

Python’s environment handling has always been troublesome, especially if you’re unfamiliar with using the command line in general. It’s better now than it was but it’s still not overly user-friendly. There’s even an xkcd comic about it so don’t worry if it takes some getting used to-

Can you access pipenv when using it as a module? Try python -m pipenv --version (if your system has python2 by default than that command may need to be python3 -m pipenv --version). If so you could use it that way, e.g. python3 -m pipenv install stuff...; that might be more typing than ideal but at least you’d know it works.

Normally when you install pipenv it adds a wee script in a bin directory somewhere on your PATH like /usr/bin/pipenv but it seems like that’s not the case here (this is what allows you to run the program with just the pipenv command rather than anything else).

If using python3 -m pipenv every time is too much typing you could consider writing a short script to do this and sticking it in your path or possibly aliasing it. Apologies if that doesn’t mean much to you, you may have to search for more info about what that means but there’s just a bit much to go into in a single reply, sorry.

It might be worth your time learning a bit more about the command line at some point. It’s used so often when programming that a little knowledge in it can go a long way; worth a look-in so long as it doesn’t interrupt your flow elsewhere :slightly_smiling_face:.

2 Likes

Using the python3 -m pipenv --version ended up working in the terminal. Thank you so much for the insight into how that works. I’ve added the Command Line course to my courses section, too.

1 Like