当前位置: 首页> 财经> 产业 > 《python》安装poetry库-FileNotFoundError: [WinError 2] 系统找不到指定的文件。-问题解决以及安装

《python》安装poetry库-FileNotFoundError: [WinError 2] 系统找不到指定的文件。-问题解决以及安装

时间:2025/7/10 0:00:34来源:https://blog.csdn.net/weixin_72186894/article/details/139237804 浏览次数:2次

问题描述:

使用指令:

curl -sSL https://install.python-poetry.org | python3 -

安装 poetry的时候出现这个问题:

 具体报错:

Retrieving Poetry metadata# Welcome to Poetry!This will download and install the latest version of Poetry,
a dependency and package manager for Python.It will add the `poetry` command to Poetry's bin directory, located at:C:\Users\q\AppData\Roaming\Python\ScriptsYou can uninstall at any time by executing this script with the --uninstall option,
and these changes will be reverted.Installing Poetry (1.8.3): An error occurred. Removing partial environment.
Traceback (most recent call last):File "<stdin>", line 945, in <module>File "<stdin>", line 923, in mainFile "<stdin>", line 560, in runFile "<stdin>", line 581, in installFile "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\contextlib.py", line 117, in __enter__return next(self.gen)File "<stdin>", line 653, in make_envFile "<stdin>", line 639, in make_envFile "<stdin>", line 327, in makeFile "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\venv\__init__.py", line 75, in createself._setup_pip(context)File "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\venv\__init__.py", line 298, in _setup_pipsubprocess.check_output(cmd, stderr=subprocess.STDOUT)File "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\subprocess.py", line 424, in check_outputreturn run(*popenargs, stdout=PIPE, timeout=timeout, check=True,File "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\subprocess.py", line 505, in runwith Popen(*popenargs, **kwargs) as process:File "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\subprocess.py", line 951, in __init__self._execute_child(args, executable, preexec_fn, close_fds,File "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\subprocess.py", line 1420, in _execute_childhp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] 系统找不到指定的文件。

问题解决:

使用管理员下的powershell来安装。

安装代码为:

(Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -

下载的速度有点慢.....

 这里就是安装好了!

使用指令检查安装版本:

poetry --version

使用我给发的那个命令会自动帮助我们设置环境变量的。

但是我在检验的时候出现了这样的报错:

这里就是没有正确的配置环境变量。

解决!环境变量的问题!

用框中路径(根据自己的安装成功输出的来): 

 使用高级系统设置

点击新建之后,给那个路径放到这个下面。 

 

重新输入:(注意!!!可能需要重启一下电脑才可以)

poetry --version

 

完成安装!!!解决问题!!! 

关键字:《python》安装poetry库-FileNotFoundError: [WinError 2] 系统找不到指定的文件。-问题解决以及安装

版权声明:

本网仅为发布的内容提供存储空间,不对发表、转载的内容提供任何形式的保证。凡本网注明“来源:XXX网络”的作品,均转载自其它媒体,著作权归作者所有,商业转载请联系作者获得授权,非商业转载请注明出处。

我们尊重并感谢每一位作者,均已注明文章来源和作者。如因作品内容、版权或其它问题,请及时与我们联系,联系邮箱:809451989@qq.com,投稿邮箱:809451989@qq.com

责任编辑: