问题
I am trying to setup Jupyter notebook using Conda, but the python version being used by notebook is not the same as the Conda environment.
I used the following command to create the 'python_jupyter' environment.
conda create -n python_jupyter python=3.6.5 ipykernel
But in the notebook, when I check the python version I get different results depending on how I am checking it. If I check using bash command I get the expected version number 3.6.5, but from python code, I get 3.6.3(which I am guessing the default one came with default Conda installation).
When I go back to the 'base'(default) environment, the version conflict is resolved,
Why there is a python version conflict in the first image, and how do I resolve it?
Edit
When I run 'conda info' on the command line with 'python_jupyter' environment active I see python version is being reported as 3.6.3. But if I run 'python -V' I see python version 3.6.5. Why this discrepancy? Also when I try to update python using 'conda update python' it doesn't prompt me for an update which means conda thinks I am on the latest python version 3.6.5.
回答1:
The problem was solved by running conda install ipython jupyter on my python_jupyter environment. Since I were able to run jupyter notebook command with the default installation, I was under the assumption that jupyter notebook installation was complete.
conda info reports the version of Python in the base environment, and conda list or conda list -f python or python -V reports the version of Python in the currently active environment, in this case python_jupyter. Source
来源:https://stackoverflow.com/questions/50675004/conflicting-python-version-in-jupyter-notebookconda