You probably have a file called "scipy.py" in your PYTHONPATH (such as the current directory). It is overriding the interpreter's search for the actual scipy package.
Rename the file so it doesn't conflict.
Rename the file so it doesn't conflict.
Output:$ python -c 'from scipy.optimize import brentq; print("ok")'
ok
$ touch scipy.py
$ python -c 'from scipy.optimize import brentq; print("ok")'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'scipy.optimize'; 'scipy' is not a package