Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
230 views
in Technique[技术] by (71.8m points)

python - How do I create a quick launch icon for an iPython virtual environment

In Anaconda, I have created a virtual environment and have created the kernel for it by running these lines in turn in the anaconda prompt:

conda create --name my_venv python=3.7

conda activate my_venv

conda install -c anaconda ipykernel

python -m ipykernel install --user --name=my_venv

But to launch it I have to activate it within anaconda prompt and run:

jupyter notebook

I'd like to be able to just quickly launch the venv from my (Windows) desktop with an icon like the one you get when you install Anaconda for the base environment - the broken orange circle icon in the below:

enter image description here

I have tried the instructions in this article, but the resulting shortcut doesn't do anything, it just briefly flashes a window that looks like a CMD prompt, then nothing further happens.

(TLDR, the article says to copy the base env icon, right click to go to properties, and change the text in the target box from this:

E:Pythonpython.exe E:Pythoncwp.py E:Python E:Pythonpython.exe
E:PythonScriptsjupyter-notebook-script.py

to this - for a venv called tensorflow_gpu)

E:Pythonenvsensorflow_gpupython.exe E:Pythoncwp.py
E:Pythonenvsensorflow_gpu E:Pythonenvsensorflow_gpupython.exe
E:Pythonenvsensorflow_gpuScriptsjupyter-notebook-script.py

Part of the problem may be that my venv does not have a file called jupyter-notebook-script.py in its scripts folder. The contents of Scripts are:

2to3.exe, 2to3-script.py, easy_install.exe, easy_install-script.py, idle.exe, idle-script.py, iptest.exe, iptest3.exe, iptest3-script.py, iptest-script.py, ipython.exe, ipython3.exe, ipython3-script.py, ipython-script.py, jupyter.exe, jupyter-kernel.exe, jupyter-kernel-script.py, jupyter-kernelspec.exe, jupyter-kernelspec-script.py, jupyter-migrate.exe, jupyter-migrate-script.py, jupyter-run.exe, jupyter-run-script.py, jupyter-script.py, jupyter-troubleshoot.exe, jupyter-troubleshoot-script.py, pip.exe, pip3.exe, pip3-script.py, pip-script.py, pydoc.exe, pydoc-script.py, pygmentize.exe, pygmentize-script.py, pywin32_postinstall.py, pywin32_testall.py, wheel.exe, wheel-script.py.

How can I make this quick launch icon?

question from:https://stackoverflow.com/questions/65841909/how-do-i-create-a-quick-launch-icon-for-an-ipython-virtual-environment

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I think that maybe you're looking for something like this.

You can create a bash script that sets the venv that you like and that executes a certain Notebook. Let me know if this works for you.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...