工作场景
使用pycharm下启动项目 报错提示 没有安装 aliyunsdkiotclient模块
本人电脑系统 window10 python3.8.6
使用常规方法在python中pip install 安装
输入命令
pip install aliyun-python-sdk-iot-client
安装过程报错如图
部分报错代码信息参考
running build_ext
warning: GMP or MPIR library not found; Not building Crypto.PublicKey._fastmath.
building 'Crypto.Random.OSRNG.winrandom' extension
error: Microsoft Visual C++ 14.0 is required. Get it with "Build Tools for Visual Studio": https://visualstudio.microsoft.com/downloads/
----------------------------------------
ERROR: Command errored out with exit status 1: 'd:softwarepython_venvscriptspython.exe' -u -c 'import io, os, sys, setuptools, tokenize; sys.argv[0] = '"'"'C:\Users\Harry\AppData\Local\Temp\pip-install-zavujfxy\pycrypto_a7edb560defc43acab
2e89be6a94b766\setup.py'"'"'; __file__='"'"'C:\Users\Harry\AppData\Local\Temp\pip-install-zavujfxy\pycrypto_a7edb560defc43acab2e89be6a94b766\setup.py'"'"';f = getattr(tokenize, '"'"'open'"'"', open)(__file__) if os.path.exists(__file__) els
e io.StringIO('"'"'from setuptools import setup; setup()'"'"');code = f.read().replace('"'"'
'"'"', '"'"'
'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' install --record 'C:UsersHarryAppDataLocalTemppip-record-0em5micpins
tall-record.txt' --single-version-externally-managed --compile --install-headers 'd:softwarepython_venvincludesitepython3.8pycrypto' Check the logs for full command output.
尝试从阿里官方下载,豆瓣源 还是报错。
看报错提示进行分析
问题:缺少c++构建工具
点击上面报错信息中的链接下载安装c++构建工具
安装:
安装时可自定义安装路径
再官网下载 aliyun-python-sdk-iot-client-0.0.14 安装包
下载链接
https://www.cnpython.com/pypi/aliyun-python-sdk-iot-client/dl-aliyun-python-sdk-iot-client-0.0.14.tar.gz
收索:
下载:
解压:
下载后解压,将解压后的文件放入到项目的虚拟环境路径下
在pycharm中且换到该文件放入到项目的虚拟环境路径下进行安装即可
Microsoft Windows [版本 10.0.19042.928]
(c) Microsoft Corporation。保留所有权利。
(venv) C:UsersadminDesktopguiderobot_python>d:
(venv) D:>cd pythonworkHarryvenvLibsite-packagesaliyun-python-sdk-iot-client-0.0.14
(venv) D:pythonworkHarryvenvLibsite-packagesaliyun-python-sdk-iot-client-0.0.14>python setup.py install
备注:
参考类似博客 python 安装 alipay-sdk-python 遇到的坑
地址 https://blog.csdn.net/m0_37159124/article/details/109595231