'SSL Error in VSCode in virtual environment
I get an error, when I try running the following:
from bs4 import BeautifulSoup
import requests
s=requests.Session()
#headers = {'User-Agent': 'Mozilla/5.0'}
URL = 'https://www.google.com'
s.get(URL)
soup = BeautifulSoup(s.get(URL).text)
SSLError: HTTPSConnectionPool(host='www.google.com', port=443): Max retries exceeded with url: /
(Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available."))
I'm using VScode, in a virtual environment, with an anaconda distribution, and the code is in a jupyter notebook.
I also got a similar error when running pip install commands from VScode's powershell terminal.
Well, I've tried adding anaconda3 folders to the user's environment variables, and likewise with git's folder (which has openssl.exe). I've also tried installing OpenSSL from shining light productions... nothing worked.
When I copied copied libcrypto-1_1-x64.dll and libssl-1_1-x64.dll from Anaconda3\Library\bin to \Anaconda3\DLL, the VScode's powershell pip commands started to work.
However, the script above still fails to run.
Any help would be appreciated.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
