简体   繁体   中英

What is the correct syntax for launching ipython qtconsole/notebook for python version=x

What is the closest thing I can get to a correct single-line syntax for launching a specific ipython with the latest anaconda version on Microsoft Windows?

Examples (that don't work):

C:\\> ipython qtconsole --python=3 for the latest version of python 3.

C:\\> ipython notebook --python=3.3.5 for the exact version of python 3.

C:\\> ipython console --log-level=DEBUG --python=3.4 for the exact version of python 3.4 with verbose log

?

As far as I know the ipython command doesn't provide a way to choose the python version. However you can use the standard python facility for launching modules:

pythonX.Y -m IPython <other options>

For example:

python3 -m IPython qtconsole 
python3.3.5 -m IPython notebook
python3.4 -m IPython console --log-level=DEBUG

Instead of asking ipython to choose an interpreter you specify the interpreter explicitly and tell it to run the IPython installed for it.

The correct answer on a fresh anaconda install on windows is to use cmd.exe and create a new environment:

C:\Anaconda>conda create -n py3k python=3 anaconda

Anaconda fetches, extracts and links the package(s), and provides the helpful message:

#
# To activate this environment, use:
# > activate py3k
#

To which the user should type:

C:\Anaconda>activate py3k

hereby cmd.exe prints:

Activating environment "py3k"...
[py3k] C:\Anaconda>

To launch the python qtconsole based on the version declared in the line: C:\\Anaconda>conda create -n py3k python=3 anaconda the user should type:

[py3k] C:\Anaconda>ipython qtconsole

In case the user still sees python 2.7.6 it will be because s/he/it forgot to add anaconda at the end of the environment creation: C:\\Anaconda>conda create -n py3k python=3 anaconda

If a full anaconda environment is not needed, the user may initiate the needed packages only by issuing the command:

C:\Anaconda>conda create -n [name] python=[version] python=[version] [list of packages separated by spaces]

Thanks to the iPython mailing list for these inputs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM