ImportError:没有名为 mandrill 的模块
Posted
技术标签:
【中文标题】ImportError:没有名为 mandrill 的模块【英文标题】:ImportError: No module named mandrill 【发布时间】:2015-03-17 21:57:03 【问题描述】:我使用 pip 安装了 mandrill:
(venv)Jhons-MacBook-Pro:venv jhonjairoroa87$ pip install mandrill
我得到了这个结果:
Downloading/unpacking mandrill
Downloading mandrill-1.0.57.tar.gz
Running setup.py (path:/private/var/folders/x3/st96cn215h915kqwlcrmtspw0000gn/T/pip_build_jhonjairoroa87/mandrill/setup.py) egg_info for package mandrill
Requirement already satisfied (use --upgrade to upgrade): requests>=0.13.2 in /usr/local/lib/python2.7/site-packages (from mandrill)
Requirement already satisfied (use --upgrade to upgrade): docopt==0.4.0 in /usr/local/lib/python2.7/site-packages (from mandrill)
Installing collected packages: mandrill
Running setup.py install for mandrill
changing mode of build/scripts-2.7/mandrill from 644 to 755
changing mode of build/scripts-2.7/sendmail.mandrill from 644 to 755
changing mode of /usr/local/bin/mandrill to 755
changing mode of /usr/local/bin/sendmail.mandrill to 755
Successfully installed mandrill
Cleaning up...
但是当我尝试使用它时,失败了:
(venv)Jhons-MacBook-Pro:venv jhonjairoroa87$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mandrill
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named mandrill
>>>
>>> import sendmail.mandrill
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named sendmail.mandrill
有人遇到过这个问题吗?
【问题讨论】:
试试import sendmail.mandrill
不,@BhargavRao Rao。我只安装了 Python 2.7。
@jhonjairoroa87 有效吗?
@sakamisiniz,我试过了,但我仍然没有收到名为错误的模块(更新帖子)
好的。我在安装两个版本时遇到了这个问题,抱歉。
【参考方案1】:
我用
卸载了它pip uninstall mandrill
并使用 python -m 选项重新安装它:
sudo python -m pip install mandrill
现在可以完美运行了。
(venv)Jhons-MacBook-Pro:python_mandrill jhonjairoroa87$ python
Python 2.7.6 (default, Sep 9 2014, 15:04:36)
[GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.39)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mandrill
>>>
【讨论】:
以上是关于ImportError:没有名为 mandrill 的模块的主要内容,如果未能解决你的问题,请参考以下文章
ImportError:没有名为 websocket 的模块