简体   繁体   English

Pip 安装文件到旧版本 Python (Pip, Pandas, ZA7F5F35426B927417362, Mac)

[英]Pip installs files to the old version of Python (Pip, Pandas, Python, Mac)

I just started learning about Python (on macOS Mojave).我刚开始学习 Python(在 macOS Mojave 上)。 I downloaded the latest version of Python and wanted to download software libraries like pandas.我下载了最新版本的Python,想下载pandas之类的软件库。

So firstly I downloaded pip like that: sudo easy_install pip所以首先我下载了 pip : sudo easy_install pip

Then I installed pandas using pip, however pandas location is: Requirement already satisfied: pandas in./Library/Python/2.7/lib/python/site-packages (0.24.2) Then I installed pandas using pip, however pandas location is: Requirement already satisfied: pandas in./Library/Python/2.7/lib/python/site-packages (0.24.2)

However, my Pythons location is: Location of Python 3.8.2: '/Library/Frameworks/Python.framework/Versions/3.8/bin/python3'但是,我的 Python 位置是: Python 3.8.2 的位置:'/Library/Frameworks/Python.framework/Versions/3.8/bin/python3'

Also when I try importing pandas in the python command I get this: ModuleNotFoundError: No module named 'pandas'另外,当我尝试在 python 命令中导入 pandas 时,我得到这个: ModuleNotFoundError: No module named 'pandas'

Therefore, it seems that pip has installed pandas to the old version of Python.因此,pip似乎已经将pandas安装到旧版Python上。 How can I fix that?我该如何解决? Or is that even the problem?或者这甚至是问题所在? Again I am totally new to this and I don't come from a cs background.同样,我对此完全陌生,而且我不是来自 cs 背景。 Please help.请帮忙。

You might have both pip and pip3 installed, where the first is used for python 2.7 and the second for python 3.8.2您可能同时安装了pippip3 ,其中第一个用于 python 2.7 ,第二个用于 python 3.8.2

pip3 install pandas

You need to add pip to your terminal's commands.您需要将 pip 添加到终端的命令中。 In the meantime, you could do this:同时,您可以这样做:

python -m pip install pandas

Note that that will only work if when you run python -V , you get python 3.8.2 .请注意,仅当您运行python -V时,您会得到python 3.8.2

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

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