D
D
darkwhiteman2020-05-15 09:29:54
linux
darkwhiteman, 2020-05-15 09:29:54

Linux env python no module name, wtf?

I suddenly encountered such a problem: there is a python script that collects certain data, it worked perfectly, but suddenly it broke.
In the first line specified!/usr/bin/env python3
In a script there are import requests
Actually there was a ModuleNotFoundError error. If you specify !/usr/bin/python3, everything works.
What could be the problem?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir Kuts, 2020-05-15
@darkwhiteman

In the first case, you run python specified in the path from environment variables, in the second case, you run a very specific python3 interpreter file.
In the general case, these can be two different interpreters located in different paths and using their own libraries

V
Vitaly Karasik, 2020-05-15
@vitaly_il1

You probably have two installations of python3.
What does
which python3 give
?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question