简体   繁体   English

熊猫在python3中不起作用,但在python中起作用

[英]Pandas not working in python3 but works in python

I tried to run pandas in python3 . 我试图在python3运行pandas。 But I get the following error. 但是我收到以下错误。

user@client3:~/smith/Python$ python3
Python 3.7.0 (default, Oct  3 2018, 21:22:25) 
[GCC 5.5.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ModuleNotFoundError: No module named 'pandas'

So I tried to run from python , 所以我尝试从python运行,

user@client3:~/smith/Python$ python
Python 2.7.12 (default, Nov 12 2018, 14:36:49) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas as pd
>>> exit()

It works fine here. 它在这里工作正常。 So I tried to install pandas for python3 as follows, 所以我尝试如下安装python3熊猫,

user@client3:~/smith/Python$ sudo apt-get install python3-pandas
Reading package lists... Done
Building dependency tree       
Reading state information... Done
python3-pandas is already the newest version (0.17.1-3ubuntu2).
The following packages were automatically installed and are no longer required:
  linux-headers-4.4.0-139 linux-headers-4.4.0-139-generic linux-image-4.4.0-139-generic linux-image-extra-4.4.0-139-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 22 not upgraded.

It already installed for python3 . 它已经为python3安装了。 What happened here? 这里发生了什么? Why it doesn't run for python3? 为什么它不能在python3上运行?

这应该可以工作,请检查一下。

pip3 install pandas

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

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