如何将位于漫游文件夹中的文件设置为环境变量?

如何将位于漫游文件夹中的文件设置为环境变量?

我已经安装Jupyter在我的 Windows 上。该jupyter.exe命令看起来像存储在 中C:\Users\XXXX\AppData\Roaming\Python\Python310\Scripts

C:\Users\XXXX\AppData\Roaming\Python\Python310\Scripts>dir
 Volume in drive C is XXXX
 Volume Serial Number is XXXX

 Directory of C:\Users\XXXX\AppData\Roaming\Python\Python310\Scripts

27/04/2023  11:08    <DIR>          .
27/04/2023  11:08    <DIR>          ..
21/03/2023  13:23           108.427 ipython.exe
21/03/2023  13:23           108.427 ipython3.exe
27/04/2023  11:08           108.421 jupyter-console.exe
21/03/2023  13:23           108.426 jupyter-kernel.exe
21/03/2023  13:23           108.464 jupyter-kernelspec.exe
21/03/2023  13:23           108.422 jupyter-migrate.exe
27/04/2023  11:08           102.281 jupyter-qtconsole.exe
21/03/2023  13:23           108.443 jupyter-run.exe
21/03/2023  13:23           108.427 jupyter-troubleshoot.exe
21/03/2023  13:23           108.422 jupyter.exe
21/03/2023  13:23           108.418 pygmentize.exe
21/03/2023  13:23            27.225 pywin32_postinstall.py
21/03/2023  13:23             3.546 pywin32_testall.py
27/04/2023  11:08           108.415 qtpy.exe
21/03/2023  13:23    <DIR>          __pycache__
              14 File(s)      1.325.764 bytes
               3 Dir(s)  11.283.652.608 bytes free

我已经设置了jupiter.exe环境变量,但仍然出现错误'jupyter' is not recognized as an internal or external command, operable program or batch file。我尝试关闭并重新打开命令提示符并重新启动 Windows,但仍然不起作用。

C:\Users\XXXX>jupyter
'jupyter' is not recognized as an internal or external command,
operable program or batch file.

环境

这是否意味着在环境变量中设置应用程序(位于漫游文件夹中)不起作用?如何解决?

答案1

我已经设置jupiter.exe了环境变量但仍然出现错误'jupyter' is not recognized as an internal or external command, operable program or batch file

如果你PATH专门编辑变量,它的值总是目录,而不是单个文件。如果您在 PATH 中列出了整个目录,则系统只会通过 PATH 找到“jupyter.exe” Python310\Scripts

(其他变量不被系统使用根本在搜索可执行文件时,除非使用 shell 的“变量扩展”语法明确引用。例如,变量命名 jupyter%jupyter%仅当您输入Cmd 或$env:jupyterPowerShell时才会展开,但不是如果你刚刚输入了jupyter.)

相关内容