Здравствуйте помогите найти ошибку

import os
import time
import pip
import telebot
from telebot import types
from background import keep_alive  # Import function for functionality support

pip.main(['install', 'pytelegrambotapi'])

and it gives an error in the console

ModuleNotFoundError: No module named 'pip'
pip.main([‘install’, ‘pytelegrambotapi’])

Этот фрагмент кода является частью ошибки и частью вашего кода?


Is this code snippet part of the error and part of your code?

yes ,

Traceback (most recent call last):
File "/home/runner/Python/main.py", line 3, in <module>
import pip
ModuleNotFoundError: No module named 'pip'

My all code

import os
import time
import pip
import telebot
from telebot import types
from background import keep_alive  # Import function for functionality support

pip.main(['install', 'pytelegrambotapi'])
token = '/'
bot = telebot.TeleBot(token)


@bot.message_handler(commands=['start'])
def start(message):
  markup = types.InlineKeyboardMarkup()
  button1 = types.InlineKeyboardButton(
      "//",
      url='/')
  markup.add(button1)
  bot.send_message(
      message.chat.id,
      "///"
      .format(message.from_user),
      reply_markup=markup)


bot.polling(none_stop=True)

Вы можете удалить эту строку pip.main(['install', 'pytelegrambotapi']), а затем ввести в Shell эту команду: pip install pyTelegramBotAPI.


You can delete this line pip.main(['install’, 'pytelegrambotapi']), and then enter this command into the Shell: pip install pyTelegramBotAPI.

when I enter it into the Shell, it enters me like this

pip is using a content-addressable pool to install files from.
This experimental feature is enabled through --use-feature=content-addressable-pool and it is not ready for production.

Can you provide a link to your repl?

Maybe I’ll write you a telegram

and where can I get this link

image

image

image

https://replit.com/@tihghts/Python

Is this repl private?

Yes, make it public?

Yes, if it does not contain API keys not recorded in secrets.

it contains the API key

https://replit.com/@tihghts/Python

Corrected code:

import os
import time
import telebot
from telebot import types
from background import keep_alive  # Import function for functionality support

token = 'xxxxxxx'
bot = telebot.TeleBot(token)


@bot.message_handler(commands=['start'])
def start(message):
  markup = types.InlineKeyboardMarkup()
  button1 = types.InlineKeyboardButton("xxxx", url='xxxx')
  markup.add(button1)
  bot.send_message(message.chat.id,
                   "xxxxx".format(message.from_user),
                   reply_markup=markup)


bot.polling(none_stop=True)

I have removed the import and use of the pip module. Try running this code.

спасибо а как теперь сделать приватным?
thank you, but how do I make it private now?

image

image

1 Like

Вы можете отметить пост, который помог вам больше всего, как решение. Так другие пользователи, который столкнуться с такой же проблемой будут знать, как её исправить.


You can mark the post that helped you the most as a solution. So other users who encounter the same problem will know how to fix it.

1 Like

That is a warning, not an error.

2 Likes