【问题标题】:The "pip.main" function no longer exists“pip.main”函数不再存在
【发布时间】:2019-11-11 03:46:58
【问题描述】:

我正在为我的 Arduino UNO 编写代码,并按照教程进行操作,因为这是我第一次在 Arduino UNO 上使用 python。教程中的那个人使用了pip.main。我只是想开始编写代码。我正在使用 Python 3.7.5 和 pip 版本 19.2.3。我已经尝试在 Stack Overflow 和其他类似网站上四处寻找,但社区建议的所有内容都不起作用。我也有非常有限的时间来解决这个问题。这是我的代码:

try:
  from pyfirmata import Arduino, util
except:
  #the problem is here
  from pip._internal import main
  main(['install', 'pyfirmara'])
  from pyfirmata import Arduino, util

board = Arduino('')

iterator = util.Iterator(board)
iterator.start()

#code here

board.exit()

我们将不胜感激!

【问题讨论】:

标签: python python-3.x windows pip arduino-uno


【解决方案1】:

pip._module 模块是私有的,不应使用,如 leading underscore which is a Python convention 所示。

pip 工具通常不适合用作库。有关详细信息和替代解决方案,请参阅pip documentation on "Using pip from your program"

【讨论】:

    猜你喜欢
    • 2021-10-04
    • 2018-11-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-08-22
    • 1970-01-01
    • 1970-01-01
    • 2016-03-06
    相关资源
    最近更新 更多