When I tried to actually execute the sample code of web scraping using a library called selenium,
When I write import selenium, I get the error "unresolved import selenium".
I have downloaded selenium with pip, but I don't know how to handle it.
Corresponding source code
No module named'selenium'
What I tried
I tried various things with reference to such sites, but it doesn't work very well.
At the command prompt
pip install selenium
After entering, what comes out is
Requirement already satisfied: selenium in c: \ users \ minat \ appdata \ local \ programs \ python \ python38 \ lib \ site-packages (3.141.0) Requirement already satisfied: urllib3 in c: \ users \ minat \ appdata \ local \ programs \ python \ python38 \ lib \ site-packages (from selenium) (1.25.10)
So, I think that the installation itself has been completed.
Also, if you enter the following in visual studio and execute it,
import sys, pprint pprint.pprint (sys.path)
['F: \\ Program Folder \\ Python \\ webLogin', 'F: \\ Program folder \\ Python \\ webLogin', 'F: \\ Program Files (x86) \\ Microsoft Visual' 'Studio \\ Shared \\ Python37_64 \\ python37.zip', 'F: \\ Program Files (x86) \\ Microsoft Visual Studio \\ Shared \\ Python37_64 \\ DLLs', 'F: \\ Program Files (x86) \\ Microsoft Visual Studio \\ Shared \\ Python37_64 \\ lib', 'F: \\ Program Files (x86) \\ Microsoft Visual Studio \\ Shared \\ Python37_64', 'C: \\ Users \\ minat \\ AppData \\ Roaming \\ Python \\ Python37 \\ site-packages', 'F: \\ Program Files (x86) \\ Microsoft Visual' 'Studio \\ Shared \\ Python37_64 \\ lib \\ site-packages']
It has become.
Indeed, c: \ users \ minat \ appdata \localI haven't seen \ programs \ python \ python38 \ lib \ site-packages, so I added it to the user's environment variable (?) With the name PYTHONPATH.
However, it has not been improved and the situation is as follows. (I also tried rebooting.)
Personally, there is a difference between python37 and python38, so I wondered if there was something, but I didn't know what to do with it.
Thank you.Supplementary information (FW/tool version, etc.)
I don't know if it's related, but I had a little development using a library called requests before, but at that time it was loaded normally. When I opened the .sln file, I got an error when importing like selenium.
All I did today was pip --upgrade to install selenium.
>>At the command prompt
py -3.7 -m pip list
What happens if that happens?
It contained the string selenium 3.141.0.
Requests 2.24.0 existed as well.
It was the same even if I changed -3.7 to 3.8 and executed it.
Answer # 1
Since it was an inappropriate answer, I will request deletion.
Answer # 2
I don't think it's a straightforward approach, but I solved it myself.
It seems that you can use it by installing each library from "Python environment" of visual studio (button like present box on the right side of the frame "Python 3.x (64bit)" on the center of the screen).
However, in my environment, even though libraries such as selenium are already displayed, when I run it, I get a no module'selenium' error.
[Method solved this time]
I was playing around with it
Tools->Options->Python->General->"Ignore system-wide PYTHONPATH variable"
If you uncheck the checkbox, it will be loaded correctly.
To be honest, what do you mean? .. It feels like that, but this time I will end here.
Thank you to everyone for their advice.
- python 3x - library cannot be installed due to ssl error in python pip
- python - in jupyter, it comes out when the imported library is not found
- python - pip3 install mysqlclient cannot be installed
- python 3x - pillow cannot be installed on macos
- python - mnist cannot be imported
- python - blueqat cannot be installed
- python - mediapipe cannot be installed
- python - ephem module cannot be imported in vscode
- python - firebase_admin cannot be imported
- opensees pymac cannot be imported in python
- python - mysqlclient cannot be installed on centos7
- "openpyxl" cannot be imported in python
- python 3x - xg boost cannot be installed from anaconda prompt
- python - variables cannot be defined
- python - psycopg2 cannot be read by pycharm
- python - tfkerasapplication model cannot be downloaded
- python - regular expression: sub () cannot replace the matched part
- python - discord bot command cannot be started
- python - all commands cannot be used with discord bot
- Open an HTML file on Chrome using python
- Finding and summing all values in Python Selenium page
- python : Error: stale element reference: element is not attached to the page document
- python : Error while running .py script on the server
- Python, Selenium -parsing. Can't get information from dynamically filled fields
- python : One pagination element overlaps another, what should I do?
- python : How to make the code asynchronous?
- python : When using import requests with Selenium immediately after starting the browser and loading the site, the browser close
- python : How to parse a site where there is pagination and when you click on the page, the url in the browser bar does not chang
- python : When searching for a specific element, I get False as an answer, although I should get True Selenium WebDriver