簡體   English   中英

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

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

我正在安裝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以避免此類問題?

當我偶然在錯誤的環境中調用ipython(或尚未安裝它的新環境)時,遇到了這個問題。 如果您在根環境或路徑中的其他任何位置安裝了ipython,它將默默地默認為默認設置。

要檢查,請在調用ipython的地方做一個“點列表”。 如果未列出,請使用“ pip install ipython”進行安裝,然后重新運行。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM