ImportError: urllib3 v2.0 only supports OpenSSL 1.1.1+, currently the 'ssl' module is compiled with 'OpenSSL 1.1.0i 14 Aug 2018'. See:
时间: 2024-07-20 12:00:33 浏览: 124
The `ImportError` you're encountering suggests that your Python installation is attempting to use an older version of the `urllib3` library, which requires OpenSSL version 1.1.1 or higher. The error message specifically mentions that the 'ssl' module in your current environment is compiled with OpenSSL 1.1.0i from 2018, which is not compatible with the minimum required version.
Here's a brief explanation:
1. `urllib3` is a popular library for working with URLs and HTTP connections in Python, making it easier to handle tasks like making requests, handling responses, and managing connections.
2. OpenSSL is an open-source implementation of the SSL/TLS cryptographic protocols, which are used for secure communication over the internet.
3. The issue arises because newer versions of `urllib3` have been updated to enforce a higher OpenSSL requirement for security reasons and improved compatibility with modern systems.
To resolve this issue, you need to update both your `urllib3` library and OpenSSL:
- **Updating urllib3**: Make sure you're using the latest version of `urllib3`. You can do this via pip:
```
pip install --upgrade urllib3
```
- **Checking OpenSSL version**: If you're using a system-level OpenSSL, you might need to upgrade it. On Linux, you can try:
```
sudo apt-get update && sudo apt-get install openssl
```
Or if you're on macOS, you'll likely find the package as part of Homebrew:
```bash
brew upgrade openssl
```
- **Reinstalling affected packages**: After updating OpenSSL, you might need to reinstall any packages that depend on `urllib3` to ensure they use the updated dependency.
Once these steps are completed, your `urllib3` should work properly with the updated OpenSSL version.
阅读全文