VS代码:ModuleNotFoundError:没有名为“ pandas”的模块

尼西拉

尝试使用pandasVS Code导入

import pandas

并得到

Traceback (most recent call last):
  File "c:\Users\xxxx\hello\sqltest.py", line 2, in <module>
    import pandas
ModuleNotFoundError: No module named 'pandas'

试图安装pandas使用

pip install pandas

pip3 install pandas

python -m pip install pandas

分别返回

(.venv) PS C:\Users\xxxx\hello> pip3 install pandas

Requirement already satisfied: pandas in c:\users\xxxx\hello\.venv\lib\site-packages (1.1.0)
Requirement already satisfied: pytz>=2017.2 in c:\users\xxxx\hello\.venv\lib\site-packages (from pandas) (2020.1)
Requirement already satisfied: numpy>=1.15.4 in c:\users\xxxx\hello\.venv\lib\site-packages (from pandas) (1.19.1)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\xxxx\hello\.venv\lib\site-packages (from pandas) (2.8.1)
Requirement already satisfied: six>=1.5 in c:\users\xxxx\hello\.venv\lib\site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)

尝试过:

sudo pip install pandas

并得到

(.venv) PS C:\Users\xxxx\hello> sudo pip install pandas

sudo : The term 'sudo' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ sudo pip install pandas
+ ~~~~
    + CategoryInfo          : ObjectNotFound: (sudo:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException

我还尝试按照此答案在工作区设置下更改python路径使用C:\Users\xxxx\AppData\Local\Microsoft\WindowsApps\python.exe它是我在命令提示符中使用的python路径,where python但没有

然后我尝试

python -m venv .venv

哪个回来了

(.venv) PS C:\Users\xxxx\hello> python -m venv .venv

Error: [Errno 13] Permission denied: 'C:\\Users\\xxxx\\hello\\.venv\\Scripts\\python.exe'

更新:

试过了

python3.8.5 -m pip install pandas

然后返回

(.venv) PS C:\Users\xxxx\hello> python3.8.5 -m pip install pandas

python3.8.5 : The term 'python3.8.5' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ python3.8.5 -m pip install pandas
+ ~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (python3.8.5:String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
杰西·吉拉多

解决方案似乎很简单!首先要紧!

通过查看您的帖子,您似乎已经遵循了安装指南Pandas这没什么不妥,但是我必须首先根据您提供给我们的信息,您似乎正在运行Windows Powershell PS C:\Users\xxxx\hello>the error format matches Powershell因此,sudo不会被识别,因为sudo对于Unix-based类似Debian, Ubuntu, and so on这样的系统,admin命令是无效的命令!

但是,这是正确安装的方法:(我假设您正在运行Windows,但如果不是这样,请更正我,我会为您提供Unix版本!)

1-Windows键,搜索CMD并运行它,因为administrator这对于避免权限问题很重要!

2-运行pip3 install pandas python3 -m pip3 install pandas

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

VS代码:ModuleNotFoundError:没有名为“ pandas_datareader”的模块

ModuleNotFoundError:vs 代码中没有名为“django”的模块问题

ModuleNotFoundError:没有名为“ tensorflow”的模块与代码

ModuleNotFoundError:Qt Creator中没有名为“ pandas”的模块

ModuleNotFoundError:没有名为“ pandas.rpy”的模块

ModuleNotFoundError:没有名为“ pandas.plotting._timeseries”的模块

ModuleNotFoundError:没有名为“ pandas.core.indexes”的模块

ModuleNotFoundError:没有名为“pandas”的模块 - Jupyter

Kivy - ModuleNotFoundError:没有名为“pandas”的模块

ModuleNotFoundError:没有名为“ knox”的模块

ModuleNotFoundError:没有名为“项目”的模块

ModuleNotFoundError:没有名为“ camelcase”的模块

ModuleNotFoundError: 没有名为“model”的模块

ModuleNotFoundError: 没有名为“src”的模块

ModuleNotFoundError:没有名为“dbutils”的模块

ModuleNotFoundError:没有名为“ fastai”的模块

ModuleNotFoundError:没有名为“dmidecode”的模块

ModuleNotFoundError: 没有名为“tensorboard”的模块

ModuleNotFoundError:没有名为“ pynput”的模块

ModuleNotFoundError:没有名为“ jieba”的模块

ModuleNotFoundError:没有名为“ buildozer”的模块

ModuleNotFoundError:没有名为“模型”的模块

ModuleNotFoundError:没有名为“ matplotlib”的模块

ModuleNotFoundError: 没有名为“bootstrapform”的模块

ModuleNotFoundError:没有名为“ BaseHTTPServer”的模块

ModuleNotFoundError:没有名为“ Cython”的模块

ModuleNotFoundError:没有名为“ gin”的模块

没有名为“Skimage”的模块 ModuleNotFoundError

ModuleNotFoundError:没有名为“ mglearn”的模块