简体   繁体   中英

Error Importing Python Packages into Jupyter

I've been working in Jupyter IPython notebook (using Python 2.7) and haven't had any issues before this importing and installing packages. Most of my packages were installed via Anaconda. Now I'm randomly having problems importing packages that I've always been able to import. I have an example below. Please help. I'm pretty new to Python so I'm completing stuck on what the problem is and how to fix it.

import pandas as pd

ImportError Traceback (most recent call last) in () ----> 1 import pandas as pd

C:\\Users\\IBM_ADMIN\\Anaconda2\\lib\\site-packages\\pandas__init__.py in () 11 "pandas from the source directory, you may need to run " 12 "'python setup.py build_ext --inplace' to build the C " ---> 13 "extensions first.".format(module)) 14 15 from datetime import datetime

ImportError: C extension: No module named numpy not built. If you want to import pandas from the source directory, you may need to run 'python setup.py build_ext --inplace' to build the C extensions first.

conda virtual environments will help you a lot. It's good practice to use environments for your projects. And it'll help you avoid causing potential problems with your system's Python.

Try this on the command line:

conda create -n myenv anaconda
source activate myenv
jupyter notebook

That default env will already have pandas ; you can install most other things with conda install <package> or, if that doesn't work, pip install <package> .

运行此命令可以解决问题:pip install scipy-0.16.1-cp27-none-win_amd64.whl完成此操作后,所有其他软件包都可以重新安装并成功导入。

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