环境: 操作系统:windows 10 python:3.9 windows下的python环境安装python-alipay-sdk报错: pip install python-alipay-sdk WARNING: Ignoring invalid distribution -ip (d:\virtualenvs\project\lib\site-packages) WARNING: Ignoring i
环境:
操作系统:windows 10
python:3.9
windows下的python环境安装python-alipay-sdk报错:
> pip install python-alipay-sdkWARNING: Ignoring invalid distribution -ip (d:\virtualenvs\project\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\virtualenvs\project\lib\site-packages)
Collecting python-alipay-sdk
Using cached python-alipay-sdk-3.0.4.tar.gz (10 kB)
Preparing metadata (setup.py) ... done
Collecting pycryptodomex==3.9.4
Using cached pycryptodomex-3.9.4.tar.gz (11.6 MB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py egg_info did not run successfully.
│ exit code: 1
╰─> [21 lines of output]
Traceback (most recent call last):
File "<string>", line 2, in <module>
...
File "d:\virtualenvs\project\lib\site-packages\setuptools\msvc.py", line 266, in _msvc14_get_vc_env
raise distutils.errors.DistutilsPlatformError(
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-
build-tools/
Testing support for clang
[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.
WARNING: Ignoring invalid distribution -ip (d:\virtualenvs\project\lib\site-packages)
WARNING: Ignoring invalid distribution -ip (d:\virtualenvs\project\lib\site-packages)
从报错看,是在安装依赖包,pycryptodomex==3.9.4的时候报错,具体原因是:
raise distutils.errors.DistutilsPlatformError(distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 or greater is required. Get it with "Microsoft C++ Build Tools": https://visualstudio.microsoft.com/visual-cpp-
build-tools/
python 3.9的CPython解释器需要Visual C++ 14.0 or greater is required;各版本解释器对应需要的Visual C++版本:
Visual C++
CPython
14.x
3.5、3.6、3.7、3.8、3.9
10.0
3.3、3.4
9.0
2.6-3.2
解决方案:
Visual Studio 2015之后的版本,C++都是14.0或者14.0+
直接安装整个Visual Studio需要下载很大的文件,并且按安装空间也需要好几个G,直接用 Visual C++ 14.2 编译器的 standalone:https://visualstudio.microsoft.com/thank-you-downloading-visual-studio/?sku=BuildTools&rel=16
以上是Visual Studio2019构建工具下载地址;
选择“桌面开发”,默认选项即可,安装完后重启一下,然后继续执行
pip install python-alipay-sdk安装