LoginSignup
0
1

More than 3 years have passed since last update.

SSL証明書でpipがエラーする。

Posted at

ある日brew updatebrew upgradeとしたところ何個かエラーし、それ以降curlpipが軒並みsslのエラーが出るようになった。

$ pip install --upgrade pip
WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
  <略>
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/pip/

opensslを入れ直してもだめだった。

$ brew uninstall openssl
## 依存関係がある時はエラーするので以下
$ brew uninstall --ignore-dependencies openssl

$ brew install openssl

どっかに書いてあった以下もできない。

$ curl https://bootstrap.pypa.io/get-pip.py | python3

pyenvをアップデート

$ pyenv update
pyenv: no such command `update'

できない、、、

以下の方法でアップデート。

$ echo $(anyenv root)
/Users/hogehoge/.anyenv

$ cd /Users/hogehoge/.anyenv/
$ mkdir plugins
$ cd plugins

$ git clone https://github.com/znz/anyenv-update.git $(anyenv root)/plugins/anyenv-update
Cloning into '/Users/hogehoge/.anyenv/plugins/anyenv-update'...
remote: Enumerating objects: 87, done.
remote: Total 87 (delta 0), reused 0 (delta 0), pack-reused 87
Unpacking objects: 100% (87/87), 13.31 KiB | 140.00 KiB/s, done.

$ anyenv update
Skipping 'anyenv'; not git repo
Updating 'anyenv/anyenv-update'...
Updating 'nodenv'...
Updating 'nodenv/node-build'...
Updating 'nodenv/nodenv-default-packages'...
Updating 'nodenv/nodenv-vars'...
Updating 'pyenv'...
Skipping 'pyenv/python-build'; not git repo
Updating 'anyenv manifest directory'...

## pyenvで選べるpythonのversion一覧。
$ pyenv install --list 
Available versions:
  2.1.3
    :

pythonをアップデート

$ pyenv install 3.8.1
     :
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

できない、、、Xcodeのコマンドラインツールを入れろというので入れる。

$ xcode-select --install                
xcode-select: note: install requested for command line developer tools
$ pyenv install 3.8.1                   
python-build: use openssl@1.1 from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.1.tar.xz...
-> https://www.python.org/ftp/python/3.8.1/Python-3.8.1.tar.xz
Installing Python-3.8.1...
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.8.1 to /Users/hogehoge/.anyenv/envs/pyenv/versions/3.8.1

$ pyenv global 3.8.1

$ plugins pyenv versions
  system
* 3.6.5 (set by /Users/hogehoge/.python-version)
  3.8.0rc1
  3.8.1
  anaconda3-2019.07

$ python --version  
Python 3.6.5

ん、変わらない?

参考) https://qiita.com/dodo5522/items/8e9e63d8c94a70fbbbb9

## 両方とも3.6.5のままだ。
$ cat ~/.python-version
3.6.5
$ cat ~/.pyenv/version
3.6.5

## 3.8.1に書き換え(直接弄っていいのかは不明、、)
$ vi ~/.python-version
$ vi ~/.pyenv/version

できた!

$ pip install --upgrade pip
Collecting pip
  Downloading https://files.pythonhosted.org/packages/43/84/23ed6a1796480a6f1a2d38f2802901d078266bda38388954d01d3f2e821d/pip-20.1.1-py2.py3-none-any.whl (1.5MB)
     |████████████████████████████████| 1.5MB 3.1MB/s 
Installing collected packages: pip
  Found existing installation: pip 19.2.3
    Uninstalling pip-19.2.3:
      Successfully uninstalled pip-19.2.3
Successfully installed pip-20.1.1
0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1