我正在一个需要python加密模块的项目中。当我去安装它时(当我运行pip install cryptography时),我得到一个错误,并且我不知道如何解决它。您对如何解决此问题有任何想法,或有什么建议(这很常见,是否是我的pip安装出现问题):
(venv) C:\Users\PC\Documents\Codes>pip install cryptography
Collecting cryptography
Using cached https://files.pythonhosted.org/packages/be/60/da377e1bed002716fb2d5d1d1cab720f298cb33ecff7bf7adea72788e4e4/cryptography-2.8.tar.gz
Installing build dependencies ... error
Complete output from command C:\Users\PC\Documents\Codes\venv\Scripts\python.exe C:\Users\PC\Documents\Codes\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip install --ignore-installed --no-user --prefix C:\Users\PC\AppData\Local\Temp\pip-build-env-hc0skefe\overlay -
-no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.6.0 wheel "cffi>=1.8,!=1.11.3; platform_python_implementation != 'PyPy'":
Collecting setuptools>=40.6.0
Using cached https://files.pythonhosted.org/packages/3d/72/1c1498c1e908e0562b1e1cd30012580baa7d33b5b0ffdbeb5fde2462cc71/setuptools-45.2.0-py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/8c/23/848298cccf8e40f5bbb59009b32848a4c38f4e7f3364297ab3c3e2e2cd14/wheel-0.34.2-py2.py3-none-any.whl
Collecting cffi!=1.11.3,>=1.8
Using cached https://files.pythonhosted.org/packages/05/54/3324b0c46340c31b909fcec598696aaec7ddc8c18a63f2db352562d3354c/cffi-1.14.0.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "C:\Users\PC\Documents\Codes\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\msvc.py", line 489, in _find_latest_available_vc_ver
IndexError: list index out of range
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\PC\AppData\Local\Temp\pip-install-w8il8_c_\cffi\setup.py", line 127, in <module>
if sys.platform == 'win32' and uses_msvc():
File "C:\Users\PC\AppData\Local\Temp\pip-install-w8il8_c_\cffi\setup.py", line 105, in uses_msvc
return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif')
File "C:\Users\PC\AppData\Local\Programs\Python\Python38-32\lib\distutils\command\config.py", line 225, in try_compile
self._compile(body, headers, include_dirs, lang)
File "C:\Users\PC\AppData\Local\Programs\Python\Python38-32\lib\distutils\command\config.py", line 132, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "C:\Users\PC\AppData\Local\Programs\Python\Python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "C:\Users\PC\AppData\Local\Programs\Python\Python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Users\PC\Documents\Codes\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\msvc.py", line 185, in msvc14_get_vc_env
File "C:\Users\PC\Documents\Codes\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\msvc.py", line 843, in __init__
File "C:\Users\PC\Documents\Codes\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\msvc.py", line 485, in __init__
File "C:\Users\PC\Documents\Codes\venv\lib\site-packages\setuptools-40.8.0-py3.8.egg\setuptools\msvc.py", line 492, in _find_latest_available_vc_ver
distutils.errors.DistutilsPlatformError: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": https://visualstudio.microsoft.com/downloads/
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\PC\AppData\Local\Temp\pip-install-w8il8_c_\cffi\
----------------------------------------
Command "C:\Users\PC\Documents\Codes\venv\Scripts\python.exe C:\Users\PC\Documents\Codes\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip install --ignore-installed --no-user --prefix C:\Users\PC\AppData\Local\Temp\pip-build-env-hc0skefe\overlay --no-warn-script-locati
on --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.6.0 wheel "cffi>=1.8,!=1.11.3; platform_python_implementation != 'PyPy'"" failed with error code 1 in None
提前谢谢!!!!