解决腾讯云下载sts/nstall -U ython-sts报错:
应该有人会出现这样的报错:
Collecting qcloud-python-sts
Using cached qcloud-python-sts-3.1.1.tar.gz (5.9 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [6 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
File "<pip-setuptools-caller>", line 34, in <module>
File "C:\Users\suichu\AppData\Local\Temp\pip-install-ks4zcaeh\qcloud-python-sts_5d9378b728a74916bb25450687600b2e\setup.py", line 5, in <module>
long_description = fh.read()
UnicodeDecodeError: 'gbk' codec can't decode byte 0x8b in position 82: illegal multibyte sequence
[end of output]note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed× Encountered error while generating package metadata.
╰─> See above for output.note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
这里也不看是什么原因了,直接手动去官网下载:qcloud-python-sts · PyPI
下载完成后解压 是这样一个文件:
把它拖到你python包的路径下面
比如我的python安装在了C盘,那路径如下:
在腾讯云的SDK文档中 demo里是直接from sts.sts import Sts
我们只需要把上面说的下载下来的文件名字重命名为sts就好了。
这之后 我们运行代码发现还会报错,经分析是无法导入sts下的sts的sts.py中的Sts类导致的。所以我们点开文件:
双击sts.py
加上这样一句话就可以了
from sts.sts.sts import Sts
然后就解决了,干净又卫生。