Pandas 和 Python3.4 与 Python 2.7 共存

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/25172981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 22:20:34  来源:igfitidea点击:

Pandas and Python3.4 co existing with Python 2.7

pandaspython-3.4

提问by Vinay Joseph

I have pandas installed with python2.7. I also have python 3.4 installed.

我用python2.7安装了Pandas。我也安装了 python 3.4。

I can't load pandas in python3

我无法在 python3 中加载Pandas

Python 3.4.1 (v3.4.1:c0e311e010fc, May 18 2014, 00:54:21) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named 'pandas'
>>> 

I understand I need to install it separately. How do I go about having pandas in both python 2.7 and 3.4 ? I am using a mac by the way.

我知道我需要单独安装它。我如何在 python 2.7 和 3.4 中使用Pandas?顺便说一下,我正在使用 mac。

采纳答案by dannyla

You might find that you have a script called "pip3" on you system as python3.4 bundles pip in along side of python.

您可能会发现系统上有一个名为“pip3”的脚本,因为 python3.4 将 pip 与 python 捆绑在一起。

$ pip3 install pandas

回答by Vinay Joseph

Figured it out.

弄清楚了。

python3 -m pip install pandas

回答by mork

In addition to the fine answers above, please note that pandas 0.24.x releases will be the last to support Python 2! pandas 0.24.x release notes

除了上面的好答案之外,请注意,pandas 0.24.x 版本将是最后一个支持 Python 2 的版本! Pandas 0.24.x 发行说明

Quote: "Warning The 0.24.x series of releases will be the last to support Python 2. Future feature releases will support Python 3 only"

引用:“警告 0.24.x 系列版本将是最后一个支持 Python 2。未来的功能版本将仅支持 Python 3”

So, co-existence, it seems, would be limited to the 0.24.x version as a common version for both python 2 and 3.

因此,共存似乎仅限于 0.24.x 版本,作为 python 2 和 3 的通用版本。