问题
Trying to get OSMnx into jupyter conda environment. But conda environment not set correctly.
On command line:
- Created conda environment using OSMnx installation steps
- I cloned the environment to rename it 'realestate'
- Added realestate to Jupyter:
> conda activate realestate
> conda install -c anaconda ipykernel
> python -m ipykernel install --user --name=realestate
> which python
/opt/anaconda3/envs/realestate/bin/python
On Jupyter the realestate environment shows up... but when I run
!which python
I get
/opt/anaconda3/bin/python
I've created some conda environments inside of Jupyter(Conda) and they show up as
Python [conda env: otherenv]
that then produces right path
!which python
/opt/anaconda3/envs/otherenv/bin/python
What am I missing?
PS. OSMnx install is not a simple conda install
conda config --prepend channels conda-forge
conda create -n ox --strict-channel-priority osmnx
回答1:
From what I can tell, it sounds like you're trying to have OSMnx, Jupyter, and all the packages in the anaconda metapackage installed together in a single conda environment. If so, just create the conda environment with all those packages in one line, then install the ipython kernelspec in it:
conda config --prepend channels conda-forge
conda create -n realestate --strict-channel-priority osmnx anaconda jupyter
conda activate realestate
python -m ipykernel install --sys-prefix --name realestate --display-name "Python (realestate)"
jupyter kernelspec list
来源:https://stackoverflow.com/questions/63315662/adding-conda-environment-via-cmd-line-to-jupyter-doesnt-work