Python Can't install packages
(2个答案)
26天前关闭。
我正在尝试安装Python软件包http-request-randomizer
pipy。但是,当我尝试通过PyCharm venv安装它(因为这是我知道如何将软件包安装到venv中的唯一方法)时,在尝试安装加密软件包时会得到以下stacktrace。任何帮助将不胜感激:)祝你有美好的一天!
我尝试安装setuptools-rust,但似乎无法解决问题:(
(venv) C:\Users\matth\Documents\DeltaAI\InstagramMetadata>pip3 install http-request-randomizer
Collecting http-request-randomizer
Using cached https://files.pythonhosted.org/packages/7b/84/ea11a2ccbe215ac200c0e6342245f2db0747ca963f38339219e6df46b546/http_request_randomizer-1.3.2.tar.gz
Requirement already satisfied: beautifulsoup4>=4.9.3 in c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages (from http-request-randomizer) (4.9.3)
Collecting httmock>=1.3.0 (from http-request-randomizer)
Using cached https://files.pythonhosted.org/packages/ce/99/f950e23335affb58ae116aaf32565258a732b2b570aa961764df2ac0540d/httmock-1.4.0-py3-none-any.whl
Collecting psutil>=5.7.2 (from http-request-randomizer)
Using cached https://files.pythonhosted.org/packages/e1/b0/7276de53321c12981717490516b7e612364f2cb372ee8901bd4a66a000d7/psutil-5.8.0.tar.gz
Collecting python-dateutil>=2.8.1 (from http-request-randomizer)
Using cached https://files.pythonhosted.org/packages/d4/70/d60450c3dd48ef87586924207ae8907090de0b306af2bce5d134d78615cb/python_dateutil-2.8.1-py2.py3-none-any.whl
Requirement already satisfied: requests>=2.24.0 in c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages (from http-request-randomizer) (2.25.1)
Collecting pyOpenSSL>=19.1.0 (from http-request-randomizer)
Using cached https://files.pythonhosted.org/packages/b2/5e/06351ede29fd4899782ad335c2e02f1f862a887c20a3541f17c3fa1a3525/pyOpenSSL-20.0.1-py2.py3-none-any.whl
Collecting fake-useragent>=0.1.11 (from http-request-randomizer)
Using cached https://files.pythonhosted.org/packages/d1/79/af647635d6968e2deb57a208d309f6069d31cb138066d7e821e575112a80/fake-useragent-0.1.11.tar.gz
Requirement already satisfied: soupsieve>1.2; python_version >= "3.0" in c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages (from beautifulsoup4>=4.9.3->http-request-randomizer) (2.1)
Requirement already satisfied: six>=1.5 in c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages (from python-dateutil>=2.8.1->http-request-randomizer) (1.15.0)
Requirement already satisfied: idna<3,>=2.5 in c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages (from requests>=2.24.0->http-request-randomizer) (2.10)
Requirement already satisfied: urllib3<1.27,>=1.21.1 in c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages (from requests>=2.24.0->http-request-randomizer) (1.26.3)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages (from requests>=2.24.0->http-request-randomizer) (2020.12.5)
Requirement already satisfied: chardet<5,>=3.0.2 in c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages (from requests>=2.24.0->http-request-randomizer) (4.0.0)
Collecting cryptography>=3.2 (from pyOpenSSL>=19.1.0->http-request-randomizer)
Using cached https://files.pythonhosted.org/packages/fa/2d/2154d8cb773064570f48ec0b60258a4522490fcb115a6c7c9423482ca993/cryptography-3.4.6.tar.gz
Installing build dependencies ... error
Complete output from command C:\Users\matth\PycharmProjects\MATH1061\venv\Scripts\python.exe c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip install --ignore-installed --no-user --prefix C:\Users\matth\AppData\Local\Temp\pi
p-build-env-5ll8sv4r\overlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.6.0 wheel "cffi>=1.12; platform_python_implementation != 'PyPy'" setuptools-rust>=0.11.4:
Collecting setuptools>=40.6.0
Using cached https://files.pythonhosted.org/packages/15/0e/255e3d57965f318973e417d5b7034223f1223de500d91b945ddfaef42a37/setuptools-53.0.0-py3-none-any.whl
Collecting wheel
Using cached https://files.pythonhosted.org/packages/65/63/39d04c74222770ed1589c0eaba06c05891801219272420b40311cd60c880/wheel-0.36.2-py2.py3-none-any.whl
Collecting cffi>=1.12
Using cached https://files.pythonhosted.org/packages/a8/20/025f59f929bbcaa579704f443a438135918484fffaacfaddba776b374563/cffi-1.14.5.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\matth\AppData\Local\Temp\pip-install-86khw8i2\cffi\setup.py", line 127, in <module>
if sys.platform == 'win32' and uses_msvc():
File "C:\Users\matth\AppData\Local\Temp\pip-install-86khw8i2\cffi\setup.py", line 105, in uses_msvc
return config.try_compile('#ifndef _MSC_VER\n#error "not MSVC"\n#endif')
File "C:\Program Files (x86)\Python38-32\lib\distutils\command\config.py", line 225, in try_compile
self._compile(body, headers, include_dirs, lang)
File "C:\Program Files (x86)\Python38-32\lib\distutils\command\config.py", line 132, in _compile
self.compiler.compile([src], include_dirs=include_dirs)
File "C:\Program Files (x86)\Python38-32\lib\distutils\_msvccompiler.py", line 360, in compile
self.initialize()
File "C:\Program Files (x86)\Python38-32\lib\distutils\_msvccompiler.py", line 253, in initialize
vc_env = _get_vc_env(plat_spec)
File "C:\Users\matth\PycharmProjects\MATH1061\venv\lib\site-packages\setuptools\msvc.py", line 313, in msvc14_get_vc_env
return _msvc14_get_vc_env(plat_spec)
File "C:\Users\matth\PycharmProjects\MATH1061\venv\lib\site-packages\setuptools\msvc.py", line 267, 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/
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\matth\AppData\Local\Temp\pip-install-86khw8i2\cffi\
----------------------------------------
Command "C:\Users\matth\PycharmProjects\MATH1061\venv\Scripts\python.exe c:\users\matth\pycharmprojects\math1061\venv\lib\site-packages\pip-19.0.3-py3.8.egg\pip install --ignore-installed --no-user --prefix C:\Users\matth\AppData\Local\Temp\pip-build-env-5ll8sv4r\o
verlay --no-warn-script-location --no-binary :none: --only-binary :none: -i https://pypi.org/simple -- setuptools>=40.6.0 wheel "cffi>=1.12; platform_python_implementation != 'PyPy'" setuptools-rust>=0.11.4" failed with error code 1 in None
我试图
如果您查看错误消息,它说
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/
您需要按照页面中的说明设置C++环境,以便pip可以从源代码构建项目。
我是一名优秀的程序员,十分优秀!