简体   繁体   中英

import numpy not working in IDLE

I have python3.5.2 installed on a windows10 machine(Adding into the pythonpath is included in the setup with new python). I ,then, installed the Anaconda(4.2.0) version. At the command prompt when i run the python interpreter and import numpy it works fine. But when i save it as a script and try running from the IDLE, it gives

Traceback (most recent call last): File "C:\\Users\\pramesh\\Desktop\\datascience code\\test.py", line 1, in <module> from numpy import * ImportError: No module named 'numpy'

I don't know what the problem is. I donot have any other python version installed.

You do have two versions of python installed: the CPython 3.5.2 distribution you mention first, and the Anaconda 4.2.0 Python distribution you then mention. Anaconda packages a large number of 3rd party packages, including Numpy. However, the CPython 3.5.2 installation available on python.org only ships with the standard library.

These two python installs have separate package installations, so having Anaconda's numpy available doesn't make it available for the CPython install. Since you're starting the Idle with shipped with CPython, which doesn't have numpy, you're seeing this error. You have two options:

  • Install numpy for CPython. See numpy documentation for details on how to do this, but it may be difficult.
  • Use the version of Idle included with Anaconda. This should be available in the Anaconda programs folder.

If you want to use pip in Anaconda Command Prompt, cd to C:\\Anaconda\\Scripts, and use pip from there.

after that, you can use pip command. pip安装fuzzywuzzy

just instead of fuzzywuzzy install numpy there. that'll surely work

Just use python -m before pip command, so that you won't get any problem while doing so in IDLE.. ex. python -m pip install scipy/numpy

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