首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Python qtConsole和Spyder:加载模块的问题

Python qtConsole和Spyder:加载模块的问题
EN

Stack Overflow用户
提问于 2017-10-03 02:05:14
回答 1查看 500关注 0票数 4

我在Windows上使用Anaconda和Python 2.7。我想使用Jupyter QtConsole,但当我想加载某些模块时,我遇到了问题。例如:我尝试加载(在根环境中) pandas。首先,我在Spyder中这样做。Spyder中的Consol是:

代码语言:javascript
运行
复制
Python 2.7.13 |Continuum Analytics, Inc.| (default, May 11 2017, 14:07:41) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 5.3.0 -- An enhanced Interactive Python.

我可以毫无问题地导入熊猫:import pandas

然后,我在Jupyter QtConsole中尝试了同样的方法。

代码语言:javascript
运行
复制
Jupyter QtConsole 4.3.1
Python 2.7.11 (v2.7.11:6d1b6a68f775, Dec  5 2015, 20:32:19) [MSC v.1500 32 bit (Intel)]
Type "copyright", "credits" or "license" for more information.

IPython 4.1.1 -- An enhanced Interactive Python.

当我尝试导入pandas import pandas时,我得到了错误消息:

代码语言:javascript
运行
复制
ImportError                               Traceback (most recent call last)
<ipython-input-1-d6ac987968b6> in <module>()
----> 1 import pandas

ImportError: No module named pandas

当我尝试用!pip install pandas在qt控制台中安装pandas时,我得到了以下错误消息:

代码语言:javascript
运行
复制
Requirement already satisfied: pandas in c:\programdata\anaconda2_32\lib\site-packages
Requirement already satisfied: python-dateutil in c:\programdata\anaconda2_32\lib\site-packages (from pandas)
Requirement already satisfied: pytz>=2011k in c:\programdata\anaconda2_32\lib\site-packages (from pandas)
Requirement already satisfied: numpy>=1.7.0 in c:\programdata\anaconda2_32\lib\site-packages (from pandas)
Requirement already satisfied: six>=1.5 in c:\programdata\anaconda2_32\lib\site-packages (from python-dateutil->pandas)

Jupyter笔记本也是如此。我在加载import numpyimport scipy时没有任何问题。此外,我不能加载未预先安装的模块,例如qtConsole或Jupyter notebook中的import tzwhere。但我可以在Spyder中加载所有模块。非常感谢你的帮助。

EN

回答 1

Stack Overflow用户

发布于 2019-08-06 21:13:10

如何打开qt控制台?如果您从shell打开它,并且conda环境不是活动环境,那么您将无法访问它或安装的模块。下面可能是实现你想做的事情的最简单的方法。在您正在使用的任何控制台中输入命令。

  1. 通过运行以下命令,您可以查看可用的不同conda环境。

conda env list

  1. 通过运行

激活您想要的应用程序

conda activate {env_name}

  1. 通过运行

运行自动键盘控制台

jupyter qtconsole

只要它安装在环境中。

有关更多信息,请单击此处managing conda environments

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/46531157

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档