python pipのSSLエラー

お絵かき 技術 Linux

新しいサーバ(CentOS7)にpythonを入れてpip使おうとしたらエラー発生。

www.unknownengineer.net

過去手順通りインストールしたのだが、何故だろう…


id=”目次”>目次

エラー内容

とりあえずインストールしてtweepyをpipで入れようとしたらこんなエラーが発生。

# pip3 install tweepy
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.
Collecting tweepy
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/tweepy/
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/tweepy/
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/tweepy/
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/tweepy/
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/tweepy/
Could not fetch URL https://pypi.python.org/simple/tweepy/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.python.org', port=443): Max retries exceeded with url: /simple/tweepy/ (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 tweepy (from versions: )
No matching distribution found for tweepy

少し調べてみると、opensslが入っていないことが原因とのこと。
入れてから再度実行します。

#yum install openssl-devel
# pip3 install tweepy
pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available.

エラー内容変わらず。

解消法

なんてことは無い、openssl入れてから再度makeし直してaltinstall してあげれば解消します。

# make
# make altinstall
Successfully installed pip-9.0.3 setuptools-39.0.1
# pip3 install --upgrade pip
# pip3 install tweepy

とりあえず、こんなもんで。

【プロフィール】

【無音鈴鹿】
お絵かきが好きなエンジニアの成れの果て

Twitter


【広告】