[PYTHON] Les mesures jusqu'à l'importation tk, matplotlib, etc. ne peuvent pas être effectuées lorsque TSL / SSL n'est pas disponible

Je ne peux pas installer pip

Je ne pouvais pas le faire car je n'avais pas installé la bibliothèque depuis la mise à jour du système d'exploitation. TSL / SSL semble être un problème. Il semble que pyenv ne puisse pas suivre la mise à jour lorsque je la vérifie Les détails de l'erreur suivante

pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting numpy
  Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Retrying (Retry(total=3, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Retrying (Retry(total=2, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Retrying (Retry(total=1, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Retrying (Retry(total=0, connect=None, read=None, redirect=None, status=None)) after connection broken by 'SSLError("Can't connect to HTTPS URL because the SSL module is not available.")': /simple/numpy/
  Could not fetch URL https://pypi.org/simple/numpy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/numpy/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  Could not find a version that satisfies the requirement numpy (from versions: )
No matching distribution found for numpy
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
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("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping

J'ai essayé toutes les mesures, mais je vais énumérer celles qui ont été résolues. Notez que pyenv sera supprimé, vous ne pouvez donc pas le restaurer à moins que vous ne notiez la version que vous utilisiez.

$ pyenv uninstall 3.6.6 (your version)
$ which python
/Users/[user name]/.pyenv/shims/python
$ rm -rf /Users/[user name]/.pyenv
$ sudo brew uninstall pyenv
$ brew install pyenv
$ pyenv install 3.6.6
$ pip install [library] [library] ....

.. .. .. Cela a corrigé l'erreur TSL / SSL. La réinstallation de python est un problème

Impossible d'importer tk (matolotlib)

Un problème est également survenu.

Je ne peux pas importer tk. Je ne peux pas utiliser matplotlib. J'étais en difficulté. Il semble qu'il n'y ait pas de module _Tkinter

$ brew reinstall tcl-tk

Je ne pense pas que ce soit la solution. https://ameblo.jp/oyasai10/entry-12526487609.htmlの通りにやったら解決した.

$ pyenv uninstall 3.6.6
https://www.activestate.com/products/tcl/tcl-tk-modules/
Ici, actif-Télécharger tcl
Pour Mac, installez-le et le programme d'installation sera dans la corbeille.
Très facile

Cela a résolu le problème autour de tk. Tout ce que vous avez à faire est de le réinstaller.

$ pyenv install 3.6.6
$ pyenv versions
*system
3.6.6
$ pyenv global 3.6.6
$ pyenv local 3.6.6
$ pyenv versions
system
*3.6.6
$ pip install matplotlib
$ python
>> import matplotlib
>>

Fini.

Recommended Posts

Les mesures jusqu'à l'importation tk, matplotlib, etc. ne peuvent pas être effectuées lorsque TSL / SSL n'est pas disponible
Comment revenir à la commande depuis l'état où vous ne pouvez pas entrer en mode interactif avec python de git bash