简体   繁体   English

为python version = x启动ipython qtconsole / notebook的正确语法是什么

[英]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? 在Microsoft Windows上使用最新的anaconda版本启动特定的ipython时,最正确的单行语法是什么?

Examples (that don't work): 示例(无效):

C:\\> ipython qtconsole --python=3 for the latest version of python 3. C:\\> ipython qtconsole --python=3以获取最新版本的python 3。

C:\\> ipython notebook --python=3.3.5 for the exact version of python 3. C:\\> ipython notebook --python=3.3.5以获取python 3的确切版本。

C:\\> ipython console --log-level=DEBUG --python=3.4 for the exact version of python 3.4 with verbose log C:\\> ipython console --log-level=DEBUG --python=3.4以获得详细版本的python 3.4的确切版本

?

As far as I know the ipython command doesn't provide a way to choose the python version. 据我所知, ipython命令没有提供选择python版本的方法。 However you can use the standard python facility for launching modules: 但是,您可以使用标准的python工具来启动模块:

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. 无需让ipython选择解释器,而是显式指定解释器并告诉它运行为其安装的IPython

The correct answer on a fresh anaconda install on windows is to use cmd.exe and create a new environment: 在Windows上全新安装anaconda的正确答案是使用cmd.exe并创建一个新环境:

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

Anaconda fetches, extracts and links the package(s), and provides the helpful message: Anaconda提取,提取并链接包,并提供有用的消息:

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

To which the user should type: 用户应输入以下内容:

C:\Anaconda>activate py3k

hereby cmd.exe prints: 特此cmd.exe打印:

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: 要基于以下行中声明的版本启动python qtconsole: C:\\Anaconda>conda create -n py3k python=3 anaconda ,用户应输入:

[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 如果用户仍然看到python 2.7.6,那是因为他/他/它忘记了在环境创建结束时添加anaconda: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: 如果不需要完整的anaconda环境,则用户只能通过发出以下命令来启动所需的软件包:

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. 感谢这些输入的iPython邮件列表。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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