Python3.6 安装pip install alipay-sdk-python 遇到pycrypto安装错误

Python3.6 安装pip install alipay-sdk-python 遇到pycrypto安装错误:

pip install pycrypto

如果是Windows系统,到这里可能安装出错了,可能出现的错误如下:

  • error: command ‘cl.exe’ failed: No such file or directory
  • error: command ‘C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\BIN\\x86_amd64\\cl.exe’ failed with exit status 2
  • error: Microsoft Visual C++ 14.0 is required. Get it with “Microsoft Visual C++ Build Tools”: http://landinghub.visualstudio.com/visual-cpp-build-tools

我的已安装有了,

完成安装之后,我们进行环境变量中用户变量(不是系统变量)的设置。

变量名称:VCINSTALLDIR

变量值:C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC

接下来,打开cmd,执行如下命令:

set CL=/FI"%VCINSTALLDIR%\\INCLUDE\\stdint.h" %CL%

注意:如果是虚拟环境,请在虚拟环境的命令行中输入此命令,并且命令中的符号都是英文半角的,网上有的资料中引号是中文符号,导致仍然无法安装Pycrypto(我特么就是受害者…)。

如果还报错误“src/winrand.c: fatal error C1083: Cannot open include file: ‘%VCINSTALLDIR%\\INCLUDE\\stdint.h’: No such file or directory”,可以尝试把命令改为绝对路径。我的就是这个:

set CL=/FI"C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\\INCLUDE\\stdint.h" %CL%

完成上述步骤之后,重新执行安装Pycrypto的命令,就应该不出什么问题了。

注意:建议每次执行上述命令时,先通过“set CL=”命令,将已有设置清空。

继续安装alipay-sdk-python。

猜你喜欢

转载自www.cnblogs.com/liuye1990/p/13386685.html
今日推荐