V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
推荐学习书目
Learn Python the Hard Way
Python Sites
PyPI - Python Package Index
http://diveintopython.org/toc/index.html
Pocoo
值得关注的项目
PyPy
Celery
Jinja2
Read the Docs
gevent
pyenv
virtualenv
Stackless Python
Beautiful Soup
结巴中文分词
Green Unicorn
Sentry
Shovel
Pyflakes
pytest
Python 编程
pep8 Checker
Styles
PEP 8
Google Python Style Guide
Code Style from The Hitchhiker's Guide
daijinming
V2EX  ›  Python

Python3 运行一个导入 pika 模块的 文件 product.py 提示 ModuleNotFoundError

  •  
  •   daijinming · 2019-03-05 16:42:29 +08:00 · 2538 次点击
    这是一个创建于 1850 天前的主题,其中的信息可能已经有所发展或是发生改变。

    之前在目录下已经执行过pipenv install pika,Pipfile 中已经存在 pika = "*" , 并且在 Pycharm 中运行完全没有问题,但是不知道为什么,在命令行中运行 python3 product.py 提示

    ModuleNotFoundError: No module named 'pika'

    代码地址

    求指教

    4 条回复    2019-03-05 17:57:20 +08:00
    ysc3839
        1
    ysc3839  
       2019-03-05 17:25:50 +08:00 via Android
    命令行忘记执行 pipenv shell ?
    daijinming
        2
    daijinming  
    OP
       2019-03-05 17:36:18 +08:00
    @ysc3839 先执行了下 pipenv shell,在执行就可以了。为什么那,有的 .py 就不用执行
    baichen99
        3
    baichen99  
       2019-03-05 17:44:58 +08:00 via iPhone
    @daijinming 因为你使用的库在全局环境已经存在了
    daijinming
        4
    daijinming  
    OP
       2019-03-05 17:57:20 +08:00
    @baichen99 那明白了
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   1135 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 24ms · UTC 18:42 · PVG 02:42 · LAX 11:42 · JFK 14:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.