一、配置环境变量(set和setx)
1、设置临时变量
set PATH=%PATH%; newValue
或者
PATH=%PATH%; newValue
2、设置用户变量
setx path oldValue;newValue
setx PATH "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\wjl\AppData\Local\Microsoft\WindowsApps;;i:\Program Files\JetBrains\PyCharm Community Edition 2019.2.5\bin;I:\Users\wjl\AppData\Local\Programs\Python\Python37-32"
3、设置系统变量(/m)
setx path %oldValue%;%newValue% /m
setx PATH "C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Users\wjl\AppData\Local\Microsoft\WindowsApps;;i:\Program Files\JetBrains\PyCharm Community Edition 2019.2.5\bin";"I:\Users\wjl\AppData\Local\Programs\Python\Python37-32" /m
二、查看python版本
1、进入python前
python --version
2、进入python后:
help()
或者:
import sys
sys.version
三、pip安装和卸载模块
安装:python -m pip install "模块名"
卸载:python -m pip uninstall "模块名"
TIPS:
在使用setx命令配置用户变量或者环境变量时,可能会遇到如下报错:
其原因是之前已经存在的系统变量中有空格,设置时注意用双引号括起来。
参考文档:
1、http://www.hxstrive.com/article/608.htm
2、https://blog.csdn.net/u011537121/article/details/80004921
3、https://blog.csdn.net/daidaiisdaidai/article/details/88696437