简体   繁体   English

ipython使用python3.4而不是python3.6

[英]ipython using python3.4 rather than python3.6

I'm working on a ubuntu 14.04 machine with python3.6 installed. 我正在安装python3.6的ubuntu 14.04机器上工作。 When I bring up the python shell using the "python3" command it invokes the python3.6.1 version as shown below and I'm successfully able to import pandas library 当我使用“ python3”命令调出python shell时,它将调用python3.6.1版本,如下所示,并且我能够成功导入pandas库

python3
Python 3.6.1 (default, Jun 13 2017, 21:37:44) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.    
>>> import pandas
>>>

But when I invoke the ipython shell by the command ipython3, it is using python 3.4.3 as shown below and I'm unable to import the pandas library. 但是,当我通过命令ipython3调用ipython shell时,它正在使用python 3.4.3,如下所示,并且我无法导入pandas库。 How do I tell ipython3 to use python3.6.1 version? 如何告诉ipython3使用python3.6.1版本?

ipython3
Python 3.4.3 (default, Nov 17 2016, 01:11:57) 
Type "copyright", "credits" or "license" for more information.
IPython 1.2.1 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.
In [1]: import pandas
---------------------------------------------------------------------------
ImportError                               Traceback (most recent call last)
<ipython-input-1-d6ac987968b6> in <module>()
----> 1 import pandas
ImportError: No module named 'pandas'

How can I deal with multiple versions of python to avoid such problems? 我如何处理多个版本的python以避免此类问题?

I've had this problem when I've accidentally been in the wrong environment invoking ipython (or a new environment where it isn't installed yet). 当我偶然在错误的环境中调用ipython(或尚未安装它的新环境)时,遇到了这个问题。 If you have ipython installed in your root environment or anywhere else on your path it will default to that instead, fairly silently. 如果您在根环境或路径中的其他任何位置安装了ipython,它将默默地默认为默认设置。

To check do a 'pip list', where you are invoking ipython. 要检查,请在调用ipython的地方做一个“点列表”。 If it isn't listed, install it with 'pip install ipython' and then rerun. 如果未列出,请使用“ pip install ipython”进行安装,然后重新运行。

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

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