When I try to
import bs4
I keep getting the error
ImportError: No module named bs4
I have tried to address this by trying all of the following (individually and together) with Python 2 and Python 3 and have had no success. What's going wrong?
sudo pip2 install beautifulsoup4
sudo pip3 install beautifulsoup4
sudo apt-get install python-bs4
sudo apt-get install python3-bs4
Downoad it from Pypi beatifulsoup4
and find setup.py file after extracting, then install it with
sudo python setup.py install
Related
I appear to be having a chicken and egg problem here. I'm trying to install setupdocx with the command:
sudo pip3 install setupdocx
and I recieve the error
ModuleNotFoundError: No module named 'setuplib'
So I try to install setuplib with the command:
sudo pip3 install setuplib
and I recieve the error
ModuleNotFoundError: No module named 'setupdocx'
I'm completely lost as to how I'm supposed to install these 2 modules. Any help would be greatly appreciated.
I'm configuring a bot to send alerts from Zabbix, so I installed Python and the modules:
sudo apt install python python-pip python-setuptools
After that, I installed the bot API to use on Zabbix:
python -m pip install --user pyTelegramBotAPI
Created the script in /usr/lib/zabbix/alertscripts/ :
#!/usr/bin/env python
import telebot,sys
BOT_TOKEN='123TOKENAQUI321'
DESTINATION=sys.argv[1]
SUBJECT=sys.argv[2]
MESSAGE=sys.argv[3]
MESSAGE = MESSAGE.replace('/n','\n')
tb = telebot.TeleBot(BOT_TOKEN)
tb.send_message(DESTINATION,SUBJECT + '\n' + MESSAGE)
Changed permissions:
sudo chmod +x telegram
sudo chown -R zabbix telegram
And when testing the script on terminal or Zabbix the following error appears:
Traceback (most recent call last): File
"/usr/lib/zabbix/alertscripts/telegram", line 2, in
import telebot,sys ImportError: No module named 'telebot'
I tried to solve by installing the module:
python -m pip install --user telebot
Installing the module did not solve it, so I tried to use python3, and the script on the terminal worked, but in Zabbix still showing the same error. I ended up going back to python.
The telebot module does not appear with pip list, only inside the python terminal using the command help ("modules").
Does anyone know that may be causing the problem?
I managed to solve it using python3, but this time I removed the other versions of python completely before installing again, the steps were as follows:
sudo python -m pip uninstall pyTelegramBotAPI
sudo apt remove python python-pip python-setuptools
sudo apt install python3 python3-pip python3-setuptools python3-six
sudo python3 -m pip install pyTelegramBotAPI six
sudo pip install six
For like these errors, reinstall the library or use (--upgrade) when you install it!
like this:
pip uninstall telebot
pip install pyTelegramBotAPI
pip install pytelegrambotapi --upgrade
I installed TFTPy with both pip and pip3.
Then i followed the example on the TFTPy documentation, which follows:
import tftpy
server = tftpy.TftpServer('/tftpboot')
server.listen('0.0.0.0', 69)
But I get the error
ImportError: No module named tftpy
I also tried using from tftpy import tftpy. I tried using Python 2, Python 2.7 and Python 3, but still get the same error.
All help is appreciated
You can install tftpy by using command pip install tftpy. In case you do not have pip on your device, use the following commands:
yum -y install python-pip
pip install --upgrade pip
pip install tftpy
I have installed pytube by following command
sudo pip install pytube
It's ok when I import pytube from python 2.x.
But I am getting ImportError while importing from python3
Try to install the package with pip3 (sudo pip3 install pytube), in some operating systems pip refers to python2 and pip3 refers to python3.
Try to install pytube3:
sudo pip3 install pytube3
And after that you should be able to import pytube
I'm playing with my first Raspberry Pi 3 project, and I've hit a snag. I've found some example code which uses MySQL import MySQLdb as mdb, but when I try to run the code I get a 'No module named 'MySQLdb''...
I've been googling for ages now, and I'm getting no where. Here's a few of the options I've tried:
pip install mysql-python
sudo pip install mysql-python
sudo apt-get install python-mysqldb
sudo apt-get install libmysqlclient-dev
Any suggestions?
From this post, try:
apt-get install python-dev libmysqlclient-dev
pip install MySQL-python