使用conda导入 pandas 时出现问题:没有名为pandas的模块 [英] Problem import pandas with conda: No module named pandas
问题描述
我无法在脚本中导入大熊猫
im having proble with importing pandas in my script
我这样做了:
Conda列表:
然后:
为什么会这样?
推荐答案
Windows
AFAIK,Windows解决了如何在注册表中运行文件类型的程序.因此,显示的命令可能指向了系统级的Python安装.
Windows
AFAIK, Windows resolves how to run file types to programs in the registry. So it is likely the command shown is pointing back to a system-level Python installation.
要解决注册表中的所有内容,您可以
To get around whatever is in the registry, you can either
conda activate prueba
python newspaper_receipe.py
或
conda run -n prueba python newspaper_receipe.py
Unix
调整Shebang
一个可能的问题是需要调整脚本的shebang.它必须是这样的:
Unix
Adjust Shebang
One possible problem is needing to adjust the shebang on the script. It needs to be something like:
#!/usr/bin/env python
,以便系统使用活动shell会话中优先处理的Python运行脚本.
so that the system runs the script with the Python prioritized in the active shell session.
还可以在 conda运行
处明确地指示脚本在该Python中运行:
One can also explicitly direct a script to run in that Python at the conda run
:
conda run -n prueba python newspaper_reciepe.py
也就是说,这将覆盖shebang并使用 prueba env的 python
.
That is, this would override the shebang and use the prueba env's python
.
这篇关于使用conda导入 pandas 时出现问题:没有名为pandas的模块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!