Why I have SSL certificate issue with python 3.12.0 or lower but not with 3.13.1?

I can only install with pip install on the latest 3.13 version. The system version I use is 3.13 and since tensorflow requires version 3.9 - 3.12, so I need to install another version for the virtual environment with venv. However, the error below occurred and I can’t install any packages using pip

(testenv) PS D:\Virtual Env\testenv\Scripts> python --version
Python 3.11.5
(testenv) PS D:\Virtual Env\testenv\Scripts> pip list
Package    Version
---------- -------
pip        23.2.1
setuptools 65.5.0
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLEOFError(8, '[SSL: UNEXPECTED_EOF_WHILE_READING] EOF occurred in violation of protocol (_ssl.c:1006)'))) - skipping
(testenv) PS D:\Virtual Env\testenv\Scripts> pip install tensorflow
WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)'))': /simple/tensorflow/
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self-signed certificate in certificate chain (_ssl.c:1006)'))) - skipping

I assumed it uses my certificate that act as self-signed certificate or untrusted by CA? I also have lower version of openSSL but I think it comes as built-in module.

this is a shot in the dark but have you made sure your certifi package is up to date? I’m not very well versed on this issue but I’ve had a few situations especially on older machines where the certs were out of date.

pip install --upgrade certifi

Did you use admin tools to add a certificate to your windows trust store? And is that a self sign cert? Maybe to allow browser to access web sites in your organisation?