Je voulais changer le chemin du noyau dans Jupyter pour le définir sur celui que j’utilise dans la machine.
Voici les noyaux d'origine qui ont été installés dans jupyter:
jupyter kernelspec list
Noyaux disponibles:
python3 /home/n/.local/share/jupyter/kernels/python3
python2 / usr / local / share / jupyter / kernels / python2
Ensuite, j'ai vérifié le chemin de python3 dans ma machine comme ceci:
which python3
/ usr / bin / python3
$ ipython kernelspec list
J'ai supprimé le noyau de python3 comme ceci:
jupyter kernelspec uninstall python3
qui a été effectuée avec succès, puis j’ai essayé d’installer python3 en utilisant le chemin que j’avais trouvé précédemment, comme ceci:
jupyter kernelspec installer / usr / bin / python3
qui m'a donné cette erreur:
Fichier "/ usr / local / bin / jupyter-kernelspec", ligne 11, dans sys.exit (KernelSpecApp.launch_instance ())
Fichier "/usr/local/lib/python2.7/dist-packages/traitlets/config/application.py", ligne 658, en instance de lancement app.start ()
Fichier "/usr/local/lib/python2.7/dist-packages/jupyter_client/kernelspecapp.py", ligne 273, au début retourne self.subapp.start ()
Fichier "/usr/local/lib/python2.7/dist-packages/jupyter_client/kernelspecapp.py", ligne 143, au début remplacer = self.replace,
Fichier "/usr/local/lib/python2.7/dist-packages/jupyter_client/kernelspec.py", ligne 299, dans install_kernel_spec shutil.copytree (rép_source, destination)
Fichier "/usr/lib/python2.7/shutil.py", ligne 171, dans un arbre de copienames = os.listdir (src) OSError: [Errno 20] Ce n'est pas un répertoire: "/ usr / bin / python3"
Puis j'ai cherché le bon chemin comme ceci:
python3 -c "import sys; print ("n".join(sys.path))"
/usr/lib/python3.4
/usr/lib/python3.4/plat-x86_64-linux-gnu
/usr/lib/python3.4/lib-dynload
/usr/local/lib/python3.4/dist-packages
/usr/local/lib/python3.4/dist-packages/setuptools-28.8.0-py3.4.egg
/ usr / lib / python3 / dist-packages
J'ai essayé d'installer le gain comme ceci:
sudo jupyter kernelspec install /usr/lib/python3.4
[InstallKernelSpec] Noyauxpec installés python3.4 dans /usr/local/share/jupyter/kernels/python3.4
Maintenant, quand je lance jupyter, il n’ya pas du tout de noyau Python 3, je ne suis pas sûr de savoir quoi faire?
Réponses:
1 pour la réponse № 1Vous n'avez probablement pas installé ipykernel
sur votre installation de python 3. Pour installer un noyau python, procédez comme suit:
pip3 install ipykernel
python3 -m ipykernel install --user
Voir ici
0 pour la réponse № 2
J'ai pu résoudre le problème en réinstallant python3 en utilisant anaconda, fourni avec Jupyter inclus dans son emballage.
Vous pouvez installer anaconda en suivant les commandes ici: https://conda.io/docs/user-guide/install/linux.html