我正在使用Windows 7,python 3.7.6。当我尝试使用pipenv创建虚拟环境时,出现以下错误,请帮助我解决该错误。当我尝试使用venv创建虚拟环境时,它会成功创建,但是pipenv给出了此错误。
D:\MOSH Course\10_Python_Package_Index>pip install pipenv
Collecting pipenv
Using cached pipenv-2018.11.26-py3-none-any.whl (5.2 MB)
Collecting virtualenv
Downloading virtualenv-20.0.0-py2.py3-none-any.whl (4.6 MB)
|████████████████████████████████| 4.6 MB 84 kB/s
Collecting certifi
Using cached certifi-2019.11.28-py2.py3-none-any.whl (156 kB)
Requirement already satisfied: setuptools>=36.2.1 in c:\python\lib\site-packages (from pipenv) (41.2.0)
Collecting virtualenv-clone>=0.2.5
Using cached virtualenv_clone-0.5.3-py2.py3-none-any.whl (6.6 kB)
Requirement already satisfied: pip>=9.0.1 in c:\python\lib\site-packages (from pipenv) (20.0.2)
Requirement already satisfied: importlib-metadata<2,>=0.12; python_version < "3.8" in c:\python\lib\site-packages (from virtualenv->pipenv) (1.5.0)
Collecting filelock<4,>=3.0.0
Downloading filelock-3.0.12-py3-none-any.whl (7.6 kB)
Collecting appdirs<2,>=1.4.3
Downloading appdirs-1.4.3-py2.py3-none-any.whl (12 kB)
Requirement already satisfied: six<2,>=1.12.0 in c:\users\tejaswita\appdata\roaming\python\python37\site-packages (from virtualenv->pipenv) (1.14.0)
Collecting distlib<1,>=0.3.0; sys_platform == "win32"
Downloading distlib-0.3.0.zip (571 kB)
|████████████████████████████████| 571 kB 24 kB/s
Requirement already satisfied: zipp>=0.5 in c:\python\lib\site-packages (from importlib-metadata<2,>=0.12; python_version < "3.8"->virtualenv->pipenv) (2.2.0)
Installing collected packages: filelock, appdirs, distlib, virtualenv, certifi, virtualenv-clone, pipenv
Running setup.py install for distlib ... done
Successfully installed appdirs-1.4.3 certifi-2019.11.28 distlib-0.3.0 filelock-3.0.12 pipenv-2018.11.26 virtualenv-20.0.0 virtualenv-clone-0.5.3
D:\MOSH Course\10_Python_Package_Index>pipenv install requests
Creating a Pipfile for this project…
Installing requests…
Traceback (most recent call last):
File "c:\python\lib\runpy.py", line 193, in _run_module_as_main
"__main__", mod_spec)
File "c:\python\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\python\Scripts\pipenv.exe\__main__.py", line 7, in <module>
File "c:\python\lib\site-packages\pipenv\vendor\click\core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "c:\python\lib\site-packages\pipenv\vendor\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "c:\python\lib\site-packages\pipenv\vendor\click\core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "c:\python\lib\site-packages\pipenv\vendor\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "c:\python\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python\lib\site-packages\pipenv\vendor\click\decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "c:\python\lib\site-packages\pipenv\vendor\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "c:\python\lib\site-packages\pipenv\vendor\click\decorators.py", line 17, in new_func
return f(get_current_context(), *args, **kwargs)
File "c:\python\lib\site-packages\pipenv\cli\command.py", line 254, in install
editable_packages=state.installstate.editables,
File "c:\python\lib\site-packages\pipenv\core.py", line 1927, in do_install
pypi_mirror=pypi_mirror,
File "c:\python\lib\site-packages\pipenv\core.py", line 1421, in pip_install
c = delegator.run(pip_command, block=block, env=pip_config)
File "c:\python\lib\site-packages\pipenv\vendor\delegator.py", line 336, in run
c.run(block=block, binary=binary, cwd=cwd, env=env)
File "c:\python\lib\site-packages\pipenv\vendor\delegator.py", line 192, in run
s = subprocess.Popen(self._popen_args, **popen_kwargs)
File "c:\python\lib\subprocess.py", line 800, in __init__
restore_signals, start_new_session)
File "c:\python\lib\subprocess.py", line 1207, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
答案 0 :(得分:0)
以上问题看起来像Windows的pipenv中的错误。有时,Windows文件夹名称中的空格会导致此“找不到文件”错误。
删除源文件夹名称中的空格(D:\ MOSH课程...)可能会有所帮助。