原谅我,但我是 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 导入它时,我得到一个错误:no module named 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 环境.当您执行 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 文件(或您的 shell 的等效文件),然后编辑 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.
下次你会运行 python 和 import theano 你会成功.
Next time you will go to will run python and import theano you'll succeed.
这篇关于用 Anaconda 安装了一个包,无法在 Python 中导入的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!
如何在 conda 环境中安装 Selenium?How to install Selenium in a conda environment?(如何在 conda 环境中安装 Selenium?)
使用 Anaconda installe 在 Windows 上获取 CUDA 和 CUDNNget the CUDA and CUDNN version on windows with Anaconda installe(使用 Anaconda installe 在 Windows 上获取 CUDA 和 CUDNN 版本)
如何下载适用于 python 3.6 的 AnacondaHow can I download Anaconda for python 3.6(如何下载适用于 python 3.6 的 Anaconda)
使用两个不同的 Python 发行版Using two different Python Distributions(使用两个不同的 Python 发行版)
除了 OSX 上现有的 pyenv 安装之外,如何安装 AnaHow can I install Anaconda aside an existing pyenv installation on OSX?(除了 OSX 上现有的 pyenv 安装之外,如何安装 Anaconda?)
在 Cygwin 中为 Anaconda 永久设置 Python 路径Permanently set Python path for Anaconda within Cygwin(在 Cygwin 中为 Anaconda 永久设置 Python 路径)