Anaconda Jupyter Notebooks Kernel Problems

我的未来我决定 提交于 2020-07-21 10:23:41

问题


TL,DR: How can I make my machine/anaconda forget that python 3.7 exists so that I can run everything on python 3.6?

I've put the full story in a list format to make this easier to read.

1) I have a working BagOfWords in Python 2.7. It was running just fine with Jupyter Notebooks.

2) I wanted to use a python library called Newspaper, but it works best in python 3 instead of python 2.

3) I download python 3.7 so Newspaper can run.

4) Newspaper works great with Python 3.7, but another module, tensorflow, which is necessary for the BagofWords to run, is not yet updated to work with Python 3.7

5) I download Python 3.6, which works with tensorflow.

6) I delete Python 3.7 off my machine.

7) I try to reopen my work now using python 3.6 so tensorflow can work. Jupyter Notebook opens, but prompts me to select which kernel to use. I select Python 3, but I recieve this error message: Error Starting Kernel FileNotFoundError: [Errno 2] No such file or directory: '/Library/Frameworks/Python.framework/Versions/3.7/bin/python3':

8) I know that it is trying to find things though a path that no longer exists (the python 3.7 path). I delete and reinstall anaconda in the hopes that it will forget this old path (and python 3.7) so that I can work with Python 3.6. It does not work.

question: How can I make my machine/anaconda forget that python 3.7 exists so that I can run everything on python 3.6? This is my first time working with jupyter notebooks, so I have searched for answers but many of them did not make sense to me. I am working on a 2015 Macbook Pro that is running MacOs Mojave 10.14.1

Update: even trying new environments with conda didn't work. I eventually gave up and moved all my code to google colab, which I'm not a huge fan of, but at least it actually works....


回答1:


I would suggest that you just a create a new environment with the specific python version you want (3.6 in your case if you want to use tensorflow)

conda create -n yourenvname python=3.6 anaconda

After creating the environment, activate it:

source activate yourenvname (if on Windows, then: conda activate yourenvname)

Now that you have a balnk new environment you can start installing only the needed packages - tensorflow to begin with using pip.

Any other package you need in this specific environment you can install also using pip or conda install as long as the environment is activated.

Keep in mind though that you need to deactivate the environment if you want to use other versions or other packages for other projects.

Hope this helps.



来源:https://stackoverflow.com/questions/54318374/anaconda-jupyter-notebooks-kernel-problems

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!