Search code examples
pythonpipenv

Cannot run pipenv after successfully installing it


I know this has been asked before and I reviewed the previous posts, but none of those solved my issue.

I'm new to programming so I may get the terminology mixed up but I will try to explain in as much detail as I can.

I am running Python 3.8 on Visual Studio Code. I installed pipenv successfully:

python -m pip install pipenv

Then I try to actually use it and get this error:

    pipenv shell --python 3.8
pipenv : The term 'pipenv' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was 
included, verify that the path is correct and try again.
At line:1 char:1
+ pipenv shell --python 3.8
+ ~~~~~~
    + CategoryInfo          : ObjectNotFound: (pipenv:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

During installation I got this warning:

WARNING: The script f2py.exe is installed in 'C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\Scripts' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.

However, I don't actually know how to do this or even if I should, because I get this warning with every package I install but it works fine anyway.

I am following this tutorial: Video Tutorial

and the guy specifically says to run the pipenv commands in the directory where our project is, which I am doing and I get this error. Nevertheless I tried to cd to the directory where the pipenv installed and same error.

I am on Win 10 btw. What am I doing wrong?


Solution

  • You may need to add pipenv to you path variable. Check out the note section in the docs. It actually describes how to get the right location to add on Windows:

    On Windows you can find the user base binary directory by running python -m site --user-site and replacing site-packages with Scripts. For example, this could return C:\Users\Username\AppData\Roaming\Python36\site-packages so you would need to set your PATH to include C:\Users\Username\AppData\Roaming\Python36\Scripts. You can set your user PATH permanently in the Control Panel. You may need to log out for the PATH changes to take effect.

    That should get it recognized by your terminal.

    The last sentence of that reminds me (it's been a while since I used Windows) -- have you tried to restart or logout? I'm not sure if that's necessary to be honest but I know sometimes it is.

    Long story short (and only since you mentioned that you are new to programming) -- the "path" lists all of the locations that are accessible to execute from. You can add to it if you want to be able to execute new programs, like pipenv.