与Anaconda一起安装了一个软件包,无法在Python中导入 [英] Installed a package with Anaconda, can't import in Python

查看:288
本文介绍了与Anaconda一起安装了一个软件包,无法在Python中导入的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

请原谅我,但我是python的新手.我已经使用安装了一个软件包(theano) conda install theano,当我键入conda list时,表示该包存在

Forgive me but I'm new to python. I've installed a package (theano) using conda install theano, and when I type conda list, the package exists

但是,当我通过运行python进入python解释器,并尝试使用import theano导入它时,出现一个错误:没有名为theano的模块",而当我列出所有python模块时,theano却没有.不存在.

However, when I enter the python interpreter by running python, and try to import it with import theano, I get an error: "no module named theano", and when I list all python modules, theano doesn't exist.

我想念什么?

推荐答案

可能是由于您在计算机上安装了多个python env. 当您执行which python时,您可能会在计算机中安装本机python.那是/usr/bin/python

Probably due to the fact you have multiply python envs installed in your computer. when you do which python you will probably get the native python installed in your computer. that is /usr/bin/python

您想使用安装Anaconda时随附的Python. 只需将Anaconda路径添加到$PATH的开头即可. (为此,您可能需要先编辑~/.bashrc文件(或外壳程序的等效文件),然后再编辑source ~/.bashrc.

You want to use the Python that came when you installed Anaconda. Just add Anaconda path to the beginning of your $PATH. (In order to do this you probably need to edit your ~/.bashrc file (or the equivalent file for your shell) then source ~/.bashrc.

下一次您将要运行pythonimport theano时,您将成功.

Next time you will go to will run python and import theano you'll succeed.

这篇关于与Anaconda一起安装了一个软件包,无法在Python中导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆