简体   繁体   中英

How do I install and import modules such as numpy and pandas? I want to use the IDLE editing/run environment, and I have Python 3.10 installed

How do I install and import modules such as numpy and pandas? I want to use the IDLE editing/run environment, and I have Python 3.10 installed.

The error I get when I run from the IDLE Shell 3.10.0 is shown below:

Traceback (most recent call last):
  File "C:/Users/Family/Desktop/UD_work/distillation.py", line 7, in <module>
    import numpy as np
ModuleNotFoundError: No module named 'numpy'

I don't get the error when I run from the anaconda prompt

In your answer, please do not assume that I know how to do any of the administrative stuff. For example, in reading through answers of similar questions, there was a suggestion to issue the 'which python' command to find out whether more than one version is installed and which one is called by IDLE. I have no idea where to type that command.

I have the same versions of IDLE and Python installed on my Windows PC. When I attempt to run "pip install" from the command line (CLI), I get a syntax error.

  • First, open the Windows command prompt.
  • Type the Windows key and "r" on your keyboard.
  • Type "control panel" and press Enter or click OK.
  • Click on System and Security.
  • Click on Windows Tools.

You'll find the command prompt icon here. Double-click the command prompt icon. DO NOT run python (pythonw.exe or py) from the command line of the command prompt (CLI) to download your module. Type the following at the command line. Your command line should look similar to this:

C:\Users\your user_name> pip install Numpy

Do the same for whatever other module you want to download.

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