Import path problem from python.

Asked 1 years ago, Updated 1 years ago, 104 views

Environment: windows 10, pycharm community 5.0.5, python 2.7.11

Pycharm makes a new project with selenium testing sauce that it used to make There was an import problem while trying to recreate it.

From pycharm

If you open an existing A project, run Python on the terminal, and import selenium, Normal. (Source code is the same even if you run directly.))

If you create a new project, open the terminal, run Python, and import selenium, The error cannot import name webdriver occurs. (It is the same even if you run the source code directly.))

We confirmed that both projects are using python.exe in the same path as the interpreter Even if you look at sys.path in the terminal, there are things that have the same path added.

If you know what else to check, please reply. Thank you.

python pycharm import

2022-09-21 22:53

1 Answers

It was stupid.

It was because I created a new project and made the file name selenium the same as the module name.--; Of course, it works well because I changed the file name.


2022-09-21 22:53

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.