(tf) C:\Users\ilixi>pip install wxpython
Collecting wxpython
Using cached wxPython-4.2.1.tar.gz (73.7 MB)
Preparing metadata (setup.py) ... done
Requirement already satisfied: pillow in d:\environment\anaconda3\envs\tf\lib\site-packages (from wxpython) (9.5.0)
Requirement already satisfied: six in d:\environment\anaconda3\envs\tf\lib\site-packages (from wxpython) (1.16.0)
Requirement already satisfied: numpy in d:\environment\anaconda3\envs\tf\lib\site-packages (from wxpython) (1.21.6)
Building wheels for collected packages: wxpython
Building wheel for wxpython (setup.py) ... error
error: subprocess-exited-with-error
× python setup.py bdist_wheel did not run successfully.
│ exit code: 1
╰─> [29 lines of output]
running bdist_wheel
running build
Will build using: "D:\environment\anaconda3\envs\tf\python.exe"
3.7.0 (default, Jun 28 2018, 08:04:48) [MSC v.1912 64 bit (AMD64)]
Python's architecture is 64bit
cfg.VERSION: 4.2.1
Running command: build
Running command: build_wx
CL.exe: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\bin\HostX64\x64\cl.exe
Downloading microsoft.web.webview2 1.0.1185.39...
Traceback (most recent call last):
File "build.py", line 668, in getMSWebView2
import requests
File "D:\environment\anaconda3\envs\tf\lib\site-packages\requests\__init__.py", line 43, in <module>
import urllib3
File "D:\environment\anaconda3\envs\tf\lib\site-packages\urllib3\__init__.py", line 42, in <module>
"urllib3 v2.0 only supports OpenSSL 1.1.1+, currently "
ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.1.0h 27 Mar 2018'. See: https://github.com/urllib3/urllib3/issues/2168
Finished command: build_wx (0.408s)
Finished command: build (0.408s)
WARNING: Building this way assumes that all generated files have been
generated already. If that is not the case then use build.py directly
to generate the source and perform the build stage. You can use
--skip-build with the bdist_* or install commands to avoid this
message and the wxWidgets and Phoenix build steps in the future.
"D:\environment\anaconda3\envs\tf\python.exe" -u build.py build
Command '"D:\environment\anaconda3\envs\tf\python.exe" -u build.py build' failed with exit code 1.
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for wxpython
Running setup.py clean for wxpython
Failed to build wxpython
ERROR: Could not build wheels for wxpython, which is required to install pyproject.toml-based projects
解决方法:由于错误源在urllib3 v2.0 only supports OpenSSL 1.1.1+
,所以卸载掉urllib3 2.0+版本,安装1.21.1版本pip install urllib3==1.21.1
即可继续安装。