Installing pipenv on a Mac: command not found!

Hi. I am following this article tutorial:
https://www.codecademy.com/courses/learn-python-3/articles/learn-python-pipenv
I have miniconda downloaded from another off-line project that I completed with codecademy so my ~/.bash_profile looks quite different.
I thought I added where pipenv is stored to PATH as per following the video instructions, but it still says ‘command not found’ when i type pipenv into my Mac terminal.
Please help!
Thanks

1 Like

I just had a similar problem with windows, and I actually think it seems pretty similar.

First I actually uninstalled Python, then reinstalled it in its own directory, making sure to select the ‘add to PATH’ and ‘install pip’ options.
I made sure I added the directory I created to the environment variables, and then I realised you have to reboot for that to actually take effect.

Then I was able to run pip, install pipenv, add that location to PATH, and then reboot again, and now, finally, it works.

Is your virtual env for python 2.7 (which is deprecated) or a version of Python3?
(Also, I believe that pip3 is the most recent version of pip. Depending on how you installed Python3, then pip3 is already installed).

If you do a pip --version what happens?

Also, what happens if you do:
python3 -m pipenv
?

This may be of some help:

Also, Macs come with Python pre-installed. Do not uninstall Python. You can have different versions on your machine for different projects, you just have to make sure you have the correct PATH.

1 Like

Also, this might be of some help. (maybe a little clearer?):

1 Like

Thank you!
when i do pip --version I get
pip 21.1.3
and i have python 3.9.5 downloaded.
Also, python3 -m pipenv seems to work.
What is the difference between this and just pipenv?

This is confusing for many folks. (All one needs to do is search for this topic in the forums to see all the posts.)

If you do a
python -V
what happens? what’s the default?
Honestly, the video I posted above is a really good resource which I just happened to have found. He explains it very well (better than I could).

when i do python -V i get Python 3.9.5.
Thanks so much. I will have a look at the video!

1 Like

Im struggling with this too. So I can get python -m pipenv to bring up the options but if I try to do, say,
pipenv shell

it says:

pipenv: command not found

EDIT:

ok so if I type

python -m pipenv shell

it starts a pipenv shell. Can someone explain why this is or what python -m part is doing?

-m is a CLI (command line interface) flag. It means “module name”. (if you want to, you could really go down a rabbit hole reading up on CLI and all that it entails for Unix and Linux. I’ve done that :woozy_face:)

https://docs.python.org/3/using/cmdline.html#cmdoption-m

Anyway, it basically searches the system path for that module and executes it.

This might be of some use:

https://docs.python.org/3/using/cmdline.html

2 Likes