Usando un Jupyter Notebook ejecutándose con el kernel python2, intenté importar emcee
y recibí un mensaje de error:
File "/home/me/.local/lib/python2.7/site-packages/emcee/ensemble.py", line 84
parameter_names: Optional[Union[Dict[str, int], List[str]]] = None,
^
SyntaxError: invalid syntax
aparentemente porque estoy usando el kernel python2.
Luego instalé ipykernal usando:python3 -m pip install ipykernel
Luego abrí un Jupyter Notebook usando el kernel Python3. Lo intenté nuevamente import emcee
pero tuve el mismo problema. Todavía estaba buscando el emcee
módulo en la ruta de python2.
Luego lo hice pip3 install emcee
, abrí un Jupyter Notebook (kernel de Python3) pero sigo teniendo el mismo problema.
Creo que necesito decirle a Jupyter Notebook que busque la versión python3 de maestro de ceremonias, pero no estoy seguro de cómo hacerlo. Acabo de intentar:
export PYTHONPATH='/home/me/.local/lib/python3.6/site-packages/'
Pero, de nuevo, esto no solucionó el problema. Revisé sys.path
en mi Jupyter Notebook y no parecía haberse agregado la nueva ruta de Python.
¿Alguien puede decirme qué estoy haciendo mal, por favor?
Respuesta1
Jupyter Notebook realmente no estaba usando el kernel python3 a pesar de que decía que sí:
Mi kernel python3 estaba ubicado:/home/damejia/.local/share/jupyter/kernels/python3
El kernel.json
archivo era:
{
"argv": [
"python",
"-m",
"ipykernel_launcher",
"-f",
"{connection_file}"
],
"display_name": "Python 3",
"language": "python"
}
Pero "python" solo apunta a mi python2. Cambié "python" a "python3" y todo funcionó.