【问题标题】:Python idle doesn't let install telepot in shell using calling through subprocessPython idle 不允许使用通过子进程调用在 shell 中安装 Telepot
【发布时间】:2020-11-12 10:55:52
【问题描述】:

我一直在尝试通过在 python idle shell 3.6 中使用子进程调用来安装“telepot”,因为我已经将 python 版本 2.7 安装为主系统版本。

我用这个代码安装

from subprocess import call
call(['install', 'telepot'])
1
import telepot

我曾经成功导入库,但下一次又显示了

ModuleNotFoundError: 没有名为“telepot”的模块

我也试过

call(['pip', 'install', 'telepot']) 

但是失败了。 那么我应该怎么做才能在不使用命令行或终端的情况下将它安装在 python shell 中

【问题讨论】:

  • 为什么不能使用命令行?
  • 因为我安装了多个版本的python并且我安装的模块直接进入python 2.7,但我想在python 3.6中使用模块
  • 所以你应该去需要的目录然后安装在那里)

标签: python python-3.x python-2.7 subprocess telegram-bot


【解决方案1】:

所以首先你需要打开命令行(按 Win + R 并在那里写'cmd.exe',按确定)
然后写在那里cd C:\Users\YOUR_USERNAME\AppData\Local\Programs\Python\Python36-32\Lib\site-packages
然后写pip install telepot
完成)

【讨论】:

    猜你喜欢
    • 2017-02-09
    • 2017-04-18
    • 2014-02-10
    • 2017-04-08
    • 1970-01-01
    • 1970-01-01
    • 2014-10-17
    • 2012-06-04
    • 2020-05-01
    相关资源
    最近更新 更多