#http://www.python.org/ftp/python/3.12.1/python-3.12.1-amd64.exe
#http://www.python.org/ftp/python/3.12.4/python-3.12.4-amd64.exe
$client1 = new-object System.Net.WebClient
#$client1.DownloadFile('http://windows-1251783334.cos.ap-shanghai.myqcloud.com/python-3.12.4-amd64.exe','c:\python-amd64.exe')
$client1.DownloadFile('http://www.python.org/ftp/python/3.12.4/python-3.12.4-amd64.exe','c:\python-amd64.exe')
$Dir="C:\CustomPythonPath"
mkdir -force $Dir
cmd.exe /c start /wait c:\python-amd64.exe /quiet InstallAllUsers=1 PrependPath=1 TargetDir=$Dir
### /quiet --silent installation
### InstallAllUsers=1 -- install for all users
### PrependPath=1 --add PATH environment
$Dir="C:\CustomPythonPath"
& "$Dir\python.exe" -V
& "$Dir\Scripts\pip.exe" -V
& "$Dir\python.exe" -m pip install --upgrade pip -i http://mirrors.tencentyun.com/pypi/simple --trusted-host mirrors.tencentyun.com
& "$Dir\Scripts\pip.exe" install coscmd -i http://mirrors.tencentyun.com/pypi/simple --trusted-host mirrors.tencentyun.com
& "$Dir\Scripts\pip.exe" install coscmd -U -i http://mirrors.tencentyun.com/pypi/simple --trusted-host mirrors.tencentyun.com
& "$Dir\Scripts\coscmd.exe" --help
这段代码我在创建cvm的RunInstances接口userdata(自定义数据)参数里用过
https://console.cloud.tencent.com/api/explorer?Product=cvm&Version=2017-03-12&Action=RunInstances
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。
原创声明:本文系作者授权腾讯云开发者社区发表,未经许可,不得转载。
如有侵权,请联系 cloudcommunity@tencent.com 删除。