ImportError on ArchLinux ARM - python

I've made a python program that goes online and look for news on some site and if something is found it send me a message on Telegram. I've run my program on my Debian machine and it works, now I want put it on my Raspberry Pi and let it run... So I copieted all the file on my raspberry installed all the necessary library (included https://github.com/eternnoir/pyTelegramBotAPI) but when I run my program with :
python2 ./main.py
I get:
ImportError: No module named telebot
What I can do? and why I get this error?
EDIT:
Probably the error is what Bruno9779 said. Those are my output:
python2 --version ----> python 2.7.11
python --version ----> python 3.5.1
env python --version -> python 3.5.1
pip --version --------> pip 2.7.1.2 from /usr/lib/python3.5/site_packages (python 3.5)
So I changed my shebang to #!/usr/bin/python2 -tt
(I've also tried with #!/usr/bin/env python2 -tt but I still get the same error)

From what surfaced in the comments of my other answer, it looks like there could be a versión mismatch of sorts.
Try:
python2 --version
python --version
env python --version
pip --version
To see if there are mismatches.
Since you are calling the script with the command python2 I guess you are running some sort of virtualenv, where python or python3 point to another version of python.
The versión of pip you use to install packages must be the same as the version you use to run the script

Install telebot with pip:
pip install telebot
It could be in the AUR, but I am not on Arch now to check

Related

Python version mismatch during building a code

I am trying to compile a code that works with Python 3.6. On my computer (Ubuntu 20.04), Python 2.7 and 3.8 comes pre-installed. Therefore, I manually installed python 3.6 using apt-get (I am not using any third party software e.g. Anaconda). I've also installed the development branch of 3.6 (something like libpython-dev).
However, when the code compiles, it needs to install certain packages (mpi4py, h5py etc) which should correspond/build with Python 3.6. However, the process detects Python version as 3.8. I have done the following in order to force the system to use 3.6 version:
In my bashrc file, I have created an alias for python (and python3) as python3.6
alias python='python3.6'
alias python3='python3.6'
The output of 'sudo update-alternatives --config python' is:
The output of commands python --version, python -V is Python 3.6.13. Therefore, I do not understand as to how to make the code works with 3.6. Please help!
You can install these packages using :
python3 -m pip install mpi4py(package_name) or
python3.6 -m pip install package_name

python3 --version command not returning correct version

I am trying to upgrade to the most recent version of python, which is currently 3.8.5.
When I type python3 --version, I get:
Python 3.7.0
So it appears my python is not up-to-date. I then type brew upgrade python and get a warning:
Warning: python 3.8.5 already installed
So, again, I type python3 --version, and again I get:
Python 3.7.0
Why is python3 --version not returning Python 3.8.5?
(PS - if I type python --version I get Python 2.7.11 as expected for my Mac)
Homebrew is installing python 3.8.5 to a different path. Try:
brew link python3
brew update
brew upgrade python3
brew cleanup python3
You may have multiple python binaries on your system but the system path is finding 3.7.0. The command which python3 will show the path of your current python binary.
It might be worthwhile taking a look at the system path with echo $PATH to see where your system is looking for Python
Updating your system environment using export as below should enable the system to find python3.8.5
PATH="/path/to/python3.8.5/bin:${PATH}"
export PATH

How to get the python command to go back to using python 2.7 Ubuntu?

So I made a mistake and routed the python command to point to python 3.6.9 and now certain programs (namely ROS packages) are having issues. I'm on Ubuntu 18.04. I see lots of tutorials telling people how to alias python to python3 but not how to fix this issue. Also I tried to unalias python, but that did nothing.
So now when I run python --version OR python3 --version I see python 3.6.9
And when I run pip --version OR pip3 --version I see pip 20.1.1 from /home/me/.local/lib/python3.6/site-packages/pip (python 3.6)
You can install an isolated Python 2.7 in your system and actually have several versions of Python. One of the easiest ways is pyenv
You can do it like this:
curl -L https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | bash
Follow the instructions, you may need to reload your env (re-log in into the console).
Then install and set Python 2.7 as a default Python:
pyenv global 2.7.18

How can I install python-gasp on Ubuntu 16.04?

I use a Ubuntu 16.04 system, and I want to install the gasp for python.
I was told that the following commands can help me to install the python-gasp:
$ sudo apt-get install python-gasp
I tried the commands, but it seems not to work, because when I run
from gasp import
it returned as
"No module named gasp".
Then I use $ whereis python-gasp to check the location of the python-gasp I installed, and it returned as /usr/share/python-gasp
I don't know what happened.
How can I use gasp successfully?
python-gasp is module for Python 2. I don't see python3-gasp for Python 3 (Linux Mint 17 based on Ubuntu 14.04) but maybe you have on Ubuntu 16.
Ubuntu 16 as default use Python 3. Maybe you will have to install Python 2 to use gasp.
Or maybe you already have installed. Try python2 or which python2 to find path.

How to properly install python3 on Centos 7

I'm running Centos7 and it comes with Python2. I installed python3, however when I install modules with pip, python3 doesn't use them. I can run python3 by typing python3 at the CLI
python (2.x) is located in /usr/bin/python
python3 is located in /usr/local/bin/python3
I tried creating a link to python3 in /usr/bin/ as "python", but as expected, it didnt resolve anything. I renamed the current python to python2.bak It actually broke some command line functionality (tab to complete). I had to undo those changes to resolve.
Suggestions welcome. Thanks.
The IUS project has ready to go RPM packages of python34u-pip, python35u-pip, and python36u-pip. These will give you corresponding pip3.4, pip3.5, and pip3.6 commands. As expected, the packages installed by those will be available to the corresponding python3.4, python3.5, and python3.6 interpreters.
Do you have pip for python3, too? Try pip3 rather than pip. I assume your regular pip is just installing the modules for Python 2.x.

Categories

Resources