简体   繁体   中英

'pipenv' is not recognized as an internal or external command, operable program or batch file

I am a beginner in python so please be gentle and if you do have an answer please provide details.

I just installed the most recent python version 3.10 after making sure to delete all previous installations (including anaconda). I am positive my system is clear of any prior installation.

after installing python 3.10 I open my terminal and run the following:

pip list

which outputs:

pip list
Package    Version
---------- -------
pip        21.2.3
setuptools 57.4.0

Then I install pipenv

pip install pipenv

which outputs

  WARNING: The script virtualenv-clone.exe is installed in 'C:\Users\Giulio\AppData\Roaming\Python\Python310\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.
  WARNING: The script virtualenv.exe is installed in 'C:\Users\Giulio\AppData\Roaming\Python\Python310\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.
  WARNING: The scripts pipenv-resolver.exe and pipenv.exe are installed in 'C:\Users\Giulio\AppData\Roaming\Python\Python310\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.
Successfully installed backports.entry-points-selectable-1.1.0 certifi-2021.10.8 distlib-0.3.3 filelock-3.3.2 pipenv-2021.5.29 platformdirs-2.4.0 six-1.16.0 virtualenv-20.10.0 virtualenv-clone-0.5.7

Finally:

pipenv
'pipenv' is not recognized as an internal or external command,
operable program or batch file.

Now I can see that the terminal spits out 3 warning concerning paths not included in Environment Variables. I don't understand why pipenv gets installed in user folders. Indeed my python installation is in C:\Program Files (as I made sure to set up during installation):

where python
C:\Program Files\Python310\python.exe

If I run:

python -m pipenv

pipenv does his thing. So Ok I resolve to use it like this (despite all tutorials have it easy). I proceed to create a virtual environment in a given folder

python -m pipenv shell

Everything works and I see the output:

Successfully created virtual environment!
Virtualenv location: C:\Users\Giulio\.virtualenvs\project-dhMbrBv2

Finally, I inspect the.virtualenvs related folder:

01/11/2021  10:58    <DIR>          .
01/11/2021  10:58    <DIR>          ..
01/11/2021  10:54                42 .gitignore
01/11/2021  10:54                38 .project
01/11/2021  10:58                 0 contents.txt
01/11/2021  10:54    <DIR>          Lib
01/11/2021  10:54               319 pyvenv.cfg
01/11/2021  10:54    <DIR>          Scripts
               4 File(s)            399 bytes
               4 Dir(s)  660,409,012,224 bytes free

Now... shouldn't there be a BIN folder as well? For instance I would like to set the interpreter in VSCode.

I cannot understand why I am getting all of these small inconsistencies. Gladly appreciate any help!

EDIT (1): So apparently there is no \bin folder because I am using windows: In windows the \Scripts folder is created instead. But the problem of pipenv not running without the preemptive call to python persists.

You can refer to this answer solution with the highest upvotes - Windows reports error when trying to install package using pipenv

Or refer to this GitHub issue on pipenv - https://github.com/pypa/pipenv/issues/3101

  1. First, remove your current version of virtualenv: pip uninstall virtualenv
  2. Then, remove your current version of pipenv: pip uninstall pipenv
  3. When you are asked Proceed (y/n)? just enter y. This will give you a clean slate.
  4. Finally, you can once again install pipenv and its dependencies: pip install pipenv
  5. Check installation with pipenv --version

If you can afford to reinstall python, run the installer downloaded from python site and select the "Add python X.XX to PATH" checkbox and complete the installation.在这里完成

Did follow the suggested steps, but did not work, Later, set the "C:\Users\xxxxxxx\AppData\Roaming\Python\Python310\Scripts" to "PATH" environment variable and relaunched the cmd.

It worked like a charm... Note: During the installation itself it warns to set the "C:\Users\xxxxxxx\AppData\Roaming\Python\Python310\Scripts" to "PAHT" env variable

  1. Go to Advanced System Settings in Control Panel
  2. Click on Environmental Variables
  3. Under System Variables Look for PATH (If you don't see it then you can click on New and create one).
  4. Click on Edit and in Variable Value Paste Link Which Look Like This C:\Users\xxxxxxx\AppData\Roaming\Python\Python310\Scripts
  5. Click Ok

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM