Estou tentando configurar Python e Python3 para um escravo Linux Jenkins usar. Fui aconselhado a usar Pip para Python e Pip3 para Python3 em termos de gerenciamento de módulos. Não sei como, mas tanto Pip quanto Pip3 estão apontando para minha instalação do Python 3.6. Isso pode ser uma pista falsa, mas estou tentando importar um módulo 'SlackClient' e sou informado de que o módulo não pode ser encontrado, embora também diga que já está instalado. Veja abaixo para mais detalhes:
$ 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'
Sempre que tento instalar o módulo:
$ 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)
Meus ambientes estão configurados assim:
$ 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
Parece estranho que o Python não consiga ver os módulos. A única coisa que consigo pensar é que parece que ambos os Pips estão instalando pacotes no Python 3.6, mas também não entendo por que o Python3 também não consegue encontrar os módulos.