问题描述:
使用指令:
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\Scripts
You 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 main
File "<stdin>", line 560, in run
File "<stdin>", line 581, in install
File "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_env
File "<stdin>", line 639, in make_env
File "<stdin>", line 327, in make
File "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\venv\__init__.py", line 75, in create
self._setup_pip(context)
File "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\venv\__init__.py", line 298, in _setup_pip
subprocess.check_output(cmd, stderr=subprocess.STDOUT)
File "D:\python-dev\pyenv\pyenv-win\versions\3.9.5\lib\subprocess.py", line 424, in check_output
return 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 run
with 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_child
hp, 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
完成安装!!!解决问题!!!
卸载!
curl -SSL https://install.python-poetry.org | python3 - --uninstall