Linux Jenkins 슬레이브를 사용할 수 있도록 Python 및 Python3을 구성하려고 합니다. 모듈 관리 측면에서 Python용 Pip, Python3용 Pip3을 사용하라는 조언을 받았습니다. 방법은 잘 모르겠지만 Pip과 Pip3 모두 내 Python 3.6 설치를 가리키고 있습니다. 빨간 청어일 수도 있지만 'SlackClient' 모듈을 가져오려고 하는데 모듈이 이미 설치되어 있다고 나와 있는데도 모듈을 찾을 수 없다는 메시지가 표시됩니다. 자세한 내용은 아래를 참조하세요.
$ python py.py
Traceback (most recent call last):
File "py.py", line 1, in <module>
import SlackClient
ImportError: No module named SlackClient
$ python3 py.py
Traceback (most recent call last):
File "py.py", line 1, in <module>
import SlackClient
ModuleNotFoundError: No module named 'SlackClient'
모듈을 설치하려고 할 때마다:
$ pip install slackclient
Requirement already satisfied: slackclient in /usr/local/lib64/python3.6/site-packages (2.0.1)
Requirement already satisfied: aiohttp>3.5.2 in /usr/local/lib64/python3.6/site-packages (from slackclient) (3.5.4)
Requirement already satisfied: aiodns>1.0 in /usr/local/lib/python3.6/site-packages (from slackclient) (2.0.0)
Requirement already satisfied: async-timeout<4.0,>=3.0 in /usr/local/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient) (3.0.1)
Requirement already satisfied: idna-ssl>=1.0; python_version < "3.7" in /usr/local/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient) (1.1.0)
Requirement already satisfied: multidict<5.0,>=4.0 in /usr/local/lib64/python3.6/site-packages (from aiohttp>3.5.2->slackclient) (4.5.2)
Requirement already satisfied: typing-extensions>=3.6.5; python_version < "3.7" in /usr/local/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient) (3.7.4)
Requirement already satisfied: yarl<2.0,>=1.0 in /usr/local/lib64/python3.6/site-packages (from aiohttp>3.5.2->slackclient) (1.3.0)
Requirement already satisfied: attrs>=17.3.0 in /usr/local/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient) (19.1.0)
Requirement already satisfied: chardet<4.0,>=2.0 in /usr/local/lib/python3.6/site-packages (from aiohttp>3.5.2->slackclient) (3.0.4)
Requirement already satisfied: pycares>=3.0.0 in /usr/local/lib64/python3.6/site-packages (from aiodns>1.0->slackclient) (3.0.0)
Requirement already satisfied: typing; python_version < "3.7" in /usr/local/lib/python3.6/site-packages (from aiodns>1.0->slackclient) (3.7.4)
Requirement already satisfied: idna>=2.0 in /usr/local/lib/python3.6/site-packages (from idna-ssl>=1.0; python_version < "3.7"->aiohttp>3.5.2->slackclient) (2.8)
Requirement already satisfied: cffi>=1.5.0 in /usr/local/lib64/python3.6/site-packages (from pycares>=3.0.0->aiodns>1.0->slackclient) (1.12.3)
Requirement already satisfied: pycparser in /usr/local/lib/python3.6/site-packages (from cffi>=1.5.0->pycares>=3.0.0->aiodns>1.0->slackclient) (2.19)
내 환경은 다음과 같이 설정됩니다.
$ python --version
Python 2.7.14
$ python3 --version
Python 3.6.8
$ pip --version
pip 19.1.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
$ pip3 --version
pip 19.1.1 from /usr/local/lib/python3.6/site-packages/pip (python 3.6)
$ which pip
/usr/local/bin/pip
$ which pip3
/usr/local/bin/pip3
$ which python
/usr/bin/python
$ which python3
/usr/bin/python3
Python이 모듈을 볼 수 없다는 것이 이상해 보입니다. 내가 생각할 수 있는 유일한 것은 두 Pips가 Python 3.6에 패키지를 설치하는 것처럼 보이지만 Python3도 모듈을 찾을 수 없는 이유를 이해할 수 없다는 것입니다.