简体   繁体   English

如何安装导入numpy、pandas等模块? 我想使用IDLE编辑/运行环境,安装了Python 3.10

[英]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?如何安装导入numpy、pandas等模块? I want to use the IDLE editing/run environment, and I have Python 3.10 installed.我想使用IDLE编辑/运行环境,安装了Python 3.10。

The error I get when I run from the IDLE Shell 3.10.0 is shown below:从 IDLE Shell 3.10.0 运行时出现的错误如下所示:

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当我从 anaconda 提示运行时,我没有收到错误

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.例如,在阅读类似问题的答案时,有人建议发出'which python'命令以查看是否安装了多个版本以及IDLE调用了哪个版本。 I have no idea where to type that command.我不知道在哪里输入该命令。

I have the same versions of IDLE and Python installed on my Windows PC.我在我的 Windows PC 上安装了相同版本的 IDLE 和 Python。 When I attempt to run "pip install" from the command line (CLI), I get a syntax error.当我尝试从命令行 (CLI) 运行“pip install”时,出现语法错误。

  • First, open the Windows command prompt.首先,打开 Windows 命令提示符。
  • Type the Windows key and "r" on your keyboard.在键盘上键入 Windows 键和“r”。
  • Type "control panel" and press Enter or click OK.键入“控制面板”并按 Enter 或单击“确定”。
  • Click on System and Security.单击系统和安全。
  • Click on Windows Tools.单击 Windows 工具。

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.不要从命令提示符 (CLI) 的命令行运行 python(pythonw.exe 或 py)来下载您的模块。 Type the following at the command line.在命令行中键入以下内容。 Your command line should look similar to this:您的命令行应类似于以下内容:

C:\Users\your user_name> pip install Numpy C:\用户\你的用户名> pip 安装 Numpy

Do the same for whatever other module you want to download.对您要下载的任何其他模块执行相同的操作。

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

相关问题 如何在Python IDLE中使用Numpy? - How do I use Numpy in Python IDLE? 我如何使用已安装的 python 模块 - How do i use installed python modules 如果我已经安装了 Anaconda 发行版并想使用其他文本编辑器,是否需要安装 Python? - Do I need to install Python if I already have the Anaconda distribution installed and want to use other text editors? 如何使用 IDLE 或终端为 Python 安装 pandas? - How do I install pandas for Python using IDLE or terminal? 如果我想在另一台没有安装 python 的机器上运行包含模块的 python 代码,我可以这样做吗? - If I want to run python code that includes modules on another machine that doesn't have python installed, can I do this? 如何让python识别安装在虚拟环境中的模块? - how do I get python to recognize modules installed in virtual environment? 我已经在命令终端中的pip上下载了模块,然后如何在空闲文档中使用它们? - I have downloaded modules on pip in the command terminal, how do I then use them in an Idle document? 如何在Spark中为python 3.5安装numpy和pandas? - How do I install numpy and pandas for Python 3.5 in Spark? 如何在 IDLE/Python 中使用立体视觉? - How do I use stereoscopy in IDLE/Python? 我是否需要在我的机器上安装 Python 才能在虚拟环境中运行代码? - Do I need to have Python installed on my machine to run a code in a virtual environment?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM