我正在使用安装了python3.6的ubuntu 14.04机器。当我使用“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
>>>
但是当我通过命令ipython3调用ipython shell时,它正在使用python 3.4.3,如下所示,我无法导入pandas库。我怎么告诉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'
如何处理多个版本的python以避免此类问题?
答案 0 :(得分:0)
当我意外地在错误的环境中调用ipython(或者尚未安装的新环境)时,我遇到了这个问题。如果您在根环境中或路径上的任何其他位置安装了ipython,则默认情况下会相当默认。
要检查一个&#39; pip list&#39;,您要调用ipython。如果没有列出,请使用&pap install ipython&#39;安装它。然后重新运行