简体   繁体   中英

Getting Error when Running Python code on Ubuntu

This is my first time to use Ubuntu

I am using Spyder

I am following instructions I find on the ineternet

Now I am stuck

I am trying to get Python Anaconda working on Ubuntu

I installed it

trying now to test my first code

simple code

import pandas as pd
import quandl

df = quandl.get("WIKI/GOOGL")

print(df.head())

but I get ModuleNotFoundError : No Module named pandas

I have installed panadas in both ways

conda install -c anaconda pandas

and

pip3 install pandas

both ways installed

yet I am still getting same error

ModuleNotFoundError : No Module named pandas

在此处输入图片说明

In this instance, it appears that all you needed to was restart the kernel. When you install a new package, if you are using ipython, jupyternotebook, or spyder you should restart the kernel. This is why python -c "import pandas" worked, whereas in your python session, it wasn't working.

A running python kernel does not search for new packages since it started running. Starting and stopping will make sure it will find the new packages. There are probably ways to find new packages without restarting the kernel, probably by using some of importlab functions, but not sure if this would be necessary.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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