Total Pageviews

Monday, 22 May 2023

在win11上,添加环境变量的方法

 在搜索栏里,输入“系统设置”,回车,弹出”系统属性“窗口:

 

然后点击’环境变量‘,弹出如下’环境变量‘窗口:

然后,在’brite的用户变量‘部分,(brite为我的windows系统的用户名),点击PATH那一行,点击下面的“编辑”,会弹出’编辑环境变量‘窗口:


 点击’新建‘,会显示如图:


 然后,在蓝色那一行,粘贴你的可执行文件(比如you-get.exe)所在的目录的完整路径,比如:

C:\Users\brite\AppData\Roaming\Python\Python37\Scripts\ ,然后点击‘确定’,‘确定’即可。

(C:\Users\brite>pip3 install you-get
WARNING: pip is being invoked by an old script wrapper. This will fail in a future version of pip.
Please see https://github.com/pypa/pip/issues/5599 for advice on fixing the underlying issue.
To avoid this problem you can invoke Python with '-m pip' instead of running pip directly.
Defaulting to user installation because normal site-packages is not writeable
Collecting you-get
  Downloading you_get-0.4.1650-py3-none-any.whl (231 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 231.6/231.6 kB 832.0 kB/s eta 0:00:00
Installing collected packages: you-get
  WARNING: The script you-get.exe is installed in 'C:\Users\brite\AppData\Roaming\Python\Python37\Scripts' which is not on PATH.
  Consider adding this directory to PATH
or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed you-get-0.4.1650
C:\Users\brite>

此时直接运行you-get.exe会遇到错误:

C:\Users\brite>you-get.exe
'you-get' 不是内部或外部命令,也不是可运行的程序
或批处理文件。

如上那样添加环境变量后,就不会遇到错误了。


 

 

 


No comments:

Post a Comment