I am trying to use the installed python modules that I have installed through
pip. By still it is giving me the import error.
For example, I have installed
pip install selenium and trying to import it in my program then it in one of my programs but it is generating error
AttributeError: partially initialized module 'selenium' has no attribute '__version__' (most likely due to a circular import). But when running the same code in the interactive mode it’s working (you can also confirm from this image.) While running the same code in script mode it is outputing as this. So, kindly help me to get out of it.
My console output stating modules are installed and python version
Note: I have just taken
selenium as an example module but all of the installed modules are behaving in the same manner.
I am using:
Python Version: 3.11.1
Sample Code that I am trying to run:
import selenium print(selenium.__version__)
Thanks in advance 💖
I have tried reinstalling the modules and python both in my system. But it didn’t work.
You can’t run your own
selenium.py and import the pip installed package of the same name.
As the error says, that’s a circular import.
It works in interactive mode since you’re not executing a specific module file of any particular name.
Without seeing your other errors, it is not clear what’s happening for them, but you also shouldn’t name the script you’re trying to run after those modules.