pip를 사용하여 Python 패키지 설치 - "Tornado에는 최신 SSL 모듈이 필요합니다."

pip를 사용하여 Python 패키지 설치 - "Tornado에는 최신 SSL 모듈이 필요합니다."

pip를 사용하여 Tornado Python 패키지를 설치하려고 하는데 이 오류가 발생합니다. Python을 2.7.7에서 2.7.14로 업그레이드하려고 시도했지만 여전히 오류가 발생합니다. 나도 pip install --upgrade pip그것을 시도했습니다.

pip가 잘못된 Python 버전을 사용하고 있나요?

lx@LX ~ $ python -V
Python 2.7.14
lx@LX ~ $ pip -V
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
lx@LX ~ $ pip install tornado
Downloading/unpacking tornado
  Downloading tornado-5.0.1.tar.gz (504kB): 504kB downloaded
  Running setup.py (path:/tmp/pip_build_lx/tornado/setup.py) egg_info for package tornado
    Traceback (most recent call last):
      File "<string>", line 17, in <module>
      File "/tmp/pip_build_lx/tornado/setup.py", line 146, in <module>
        raise ImportError("Tornado requires an up-to-date SSL module. This means "
    ImportError: Tornado requires an up-to-date SSL module. This means Python 2.7.9+ or 3.4+ (although some distributions have backported the necessary changes to older versions).
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):

  File "<string>", line 17, in <module>

  File "/tmp/pip_build_lx/tornado/setup.py", line 146, in <module>

    raise ImportError("Tornado requires an up-to-date SSL module. This means "

ImportError: Tornado requires an up-to-date SSL module. This means Python 2.7.9+ or 3.4+ (although some distributions have backported the necessary changes to older versions).

----------------------------------------
Cleaning up...
Command python setup.py egg_info failed with error code 1 in /tmp/pip_build_lx/tornado
Storing debug log for failure in /home/lx/.pip/pip.log

파이썬 버전

lx@LX ~ $ python 
Python 2.7.14 (default, Mar 19 2018, 20:12:34) 
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> ssl
<module 'ssl' from '/usr/local/lib/python2.7/ssl.pyc'>
>>> quit()
lx@LX ~ $ 

답변1

pip를 다시 설치하여 해결됨

lx@LX ~/Downloads $ sudo python get-pip.py
[sudo] password for lx: 
The directory '/home/lx/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/lx/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pip
  Downloading pip-9.0.2-py2.py3-none-any.whl (1.4MB)
    100% |████████████████████████████████| 1.4MB 964kB/s 
Collecting setuptools
  Downloading setuptools-39.0.1-py2.py3-none-any.whl (569kB)
    100% |████████████████████████████████| 573kB 1.7MB/s 
Collecting wheel
  Downloading wheel-0.30.0-py2.py3-none-any.whl (49kB)
    100% |████████████████████████████████| 51kB 3.6MB/s 
Installing collected packages: pip, setuptools, wheel
Successfully installed pip-9.0.2 setuptools-39.0.1 wheel-0.30.0

이제 올바른 Python 버전을 사용합니다.

lx@LX ~/Downloads $ pip -V
pip 9.0.2 from /usr/local/lib/python2.7/site-packages (python 2.7)

관련 정보