我在python中运行beautifulsoup代码,它在windows10pro中以命令运行。在eclipsejava中,我得到一个

2024-04-20 10:11:47 发布

您现在位置:Python中文网/ 问答频道 /正文

我在python中运行beautifulsoup代码,它在windows10pro中以命令运行。在eclipse中,我得到一个错误。你知道吗

I work in the following order
1. windows10 pro os   
2. python-3.7.3-amd64.exe ( install )
3. pip install bs4
4. pip install selenium
5. chrome webdrive download ( windows version )
6. coding
7. windows command line ( python web_test.py )
   execution ok 
8. but eclipse java project execute ....shows 
 ImportError: No module named bs4

result : command line excute success  but eclipse java project execute fail

-------------------------------------python脚本

from bs4 import BeautifulSoup
from selenium import webdriver
driver = webdriver.Chrome('C:/python_source/util/chromedriver.exe')

---------------eclipse java项目执行python脚本

System.setProperty("python.cachedir.skip", "true");
PythonInterpreter interpreter = new PythonInterpreter();
interpreter.execfile("C:/3DP/webTest.py");
interpreter.exec("getData()");

Tags: installpippyprojectexecutewindowsseleniumline