Help us understand the problem. What is going on with this article?

macでシェルをfishに変えてpyenvとpipが上手くできなかったときの対処法

概要

bashからfishに変えてから,以前まではできていた,pyenvでpythonのインストールとpipでパッケージのインストールができなくなったのでその対処法を紹介します.

事象

例えば下記のようなエラーが発生しています.

pip install selenium                        30.8s
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting selenium
  WARNING: 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/selenium/
  WARNING: 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/selenium/
  WARNING: 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/selenium/
  WARNING: 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/selenium/
  WARNING: 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/selenium/
  Could not fetch URL https://pypi.org/simple/selenium/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/selenium/ (Caused by SSLError("Can't connect to HTTPS URL because the SSL module is not available.")) - skipping
  ERROR: Could not find a version that satisfies the requirement selenium (from versions: none)
ERROR: No matching distribution found for selenium
WARNING: 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
  • opensslそもそもある?
$ which openssl
/usr/local/opt/openssl/bin/openssl

ありますね...

解決方法

opensslが失敗しているので,読み込めてない可能性があります.

  • config.fishに以下を追記
~/.config/fish/config.fish
set -x PATH /bin $PATH  # なければ追加
set -x PATH /usr/local/bin $PATH  # なければ追加
set -x PATH /usr/local/opt/openssl/bin $PATH  # 一番重要
  • プロファイルの適用
$ source ~/.config/fish/config.fish
  • pythonのインストール

無事pythonをインストールするっことができました

pyenv install 3.6.2                         786ms
python-build: use openssl from homebrew
python-build: use readline from homebrew
Downloading Python-3.6.2.tar.xz...
-> https://www.python.org/ftp/python/3.6.2/Python-3.6.2.tar.xz
Installing Python-3.6.2...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.6.2 to /Users/taro/.anyenv/envs/pyenv/versions/3.6.2
satto_sann
触っている技術:Python, React, Ruby, Go, Docker, k8s, SDN(Trema, Faucet) OSS: FastAPI Contributor
zozotech
70億人のファッションを技術の力で変えていく
https://tech.zozo.com/
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした