Error when executing pipenv shell in python 3.9.12

63 Views Asked by At

I am trying to install and use pipenv on windows. The steps that I did: 1.pip install pipenv. 2.Added the path where pipenv was installed to the PATH. 3. Created a directory for the project and named it "work". 4. pipenv --python 3.9.12. 5.(ERROR) An error occurs when entering the "pipenv shell":

E:\work>pipenv shell
Launching subshell in virtual environment...
Traceback (most recent call last):
  File "C:\Users\NickName\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 197, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "C:\Users\NickName\AppData\Local\Programs\Python\Python39\lib\runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\Scripts\pipenv.exe\__main__.py", line 7, in <module>
    # when invoked as python -m pip <command>
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\vendor\click\core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\cli\options.py", line 58, in main
    return super().main(*args, **kwargs, windows_expand_args=False)
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\vendor\click\core.py", line 1078, in main    rv = self.invoke(ctx)
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\vendor\click\core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\vendor\click\core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\vendor\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\vendor\click\decorators.py", line 92, in new_func
    return ctx.invoke(f, obj, *args, **kwargs)
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\vendor\click\core.py", line 783, in invoke
    return __callback(*args, **kwargs)
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\cli\command.py", line 394, in shell
    do_shell(
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\routines\shell.py", line 44, in do_shell
    shell.fork(*fork_args)
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\shells.py", line 100, in fork
    _handover(self.cmd, self.args + list(args))
  File "C:\Users\NickName\AppData\Roaming\Python\Python39\site-packages\pipenv\shells.py", line 68, in _handover
    sys.exit(subprocess.call(args, shell=True, universal_newlines=True))
  File "C:\Users\NickName\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 349, in call
    with Popen(*popenargs, **kwargs) as p:
  File "C:\Users\NickName\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 951, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\NickName\AppData\Local\Programs\Python\Python39\lib\subprocess.py", line 1420, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

At the same time, if you enter pipenv --venv, after finding out the location of the environment, and then write "C:\Users\Nickname.virtualenvs\work-Qj_DraXJ\Scripts\activate", then the virtual environment will start. Also, if you enter the command "pipenv run python main.py " that main.py it will work in this virtual environment.

Why does this error occur and how can I fix it? I can clarify any details that are required. Thanks!

0

There are 0 best solutions below