Scikit-learn、TensorFlowの違いってなに?
Scikit-learnとTensorFlowは、どちらも機械学習のためのPythonライブラリですが、異なる目的や特性を持っています。
Scikit-learn:
Scikit-learnは、機械学習のための簡潔で ...これから機械学習を本格的にしていこうと思うんだけど、なにをしたらいいかな
機械学習の世界への入り口から始めるためのいくつかのステップがあります。以下は、機械学習の学習を始めるための一般的な手順です。
基礎知識の習得:
機械学習の基本的な理論を学ぶ。線形代数、確率論、統計学などの数学的な基礎 ...セキュリティ警告を無効にしたい
Seleniumを使用してセキュリティ警告を無効にするためには、ブラウザのプロファイルやオプションを変更する方法があります。以下に、ChromeとFirefoxブラウザでのセキュリティ警告を無効にする方法を示します。
Chrom ...保護されていない通信とブラウザに表示されていて、証明書が無効だと、表示されている。 これだと、seleniumは上手く動作しないのかな
保護されていない通信や無効な証明書は、ブラウザのセキュリティ機能によって警告やエラーとして表示されることがあります。Seleniumを使用して自動化テストを行う場合、ブラウザがこれらの警告やエラーを表示すると、Seleniumがブラウ ...
print(driver.page_source())
driver.page_sourceはメソッドではなく、属性です。そのため、()を使用せずにdriver.page_sourceを呼び出す必要があります。
正しいコードは以下のようになります:
pythonTraceback (most recent call last): File “Jenkins_buld.py”, line 68, in <module> driver = webdriver.Chrome(options=chrome_options) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py”, line 45, in __init__ super().__init__( File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py”, line 61, in __init__ super().__init__(command_executor=executor, options=options) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 209, in __init__ self.start_session(capabilities) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 293, in start_session response = self.execute(Command.NEW_SESSION, caps)[“value”] File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 348, in execute self.error_handler.check_response(response) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py”, line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally. (session not created: DevToolsActivePort file doesn’t exist) (The process started from chrome location google-chrome-stable is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Stacktrace: #0 0x55a62db66f83 <unknown> #1 0x55a62d81fcf7 <unknown> #2 0x55a62d85760e <unknown> #3 0x55a62d85426e <unknown> #4 0x55a62d8a480c <unknown> #5 0x55a62d898e53 <unknown> #6 0x55a62d860dd4 <unknown> #7 0x55a62d8621de <unknown> #8 0x55a62db2b531 <unknown> #9 0x55a62db2f455 <unknown> #10 0x55a62db17f55 <unknown> #11 0x55a62db300ef <unknown> #12 0x55a62dafb99f <unknown> #13 0x55a62db54008 <unknown> #14 0x55a62db541d7 <unknown> #15 0x55a62db66124 <unknown> #16 0x7f64a7c68609 start_thread
このエラーメッセージは、Chromeが正常に起動せず、セッションが作成されなかったことを示しています。一般的な原因としては、次のようなことが考えられます:
ChromeDriverとChromeの互換性の問題: 使用してい ...
(venv) ec-server@ecserver:/home/share/jenkins_build$ python3 Jenkins_buld.py メッセージが送信されました。 Traceback (most recent call last): File “Jenkins_buld.py”, line 68, in <module> driver = webdriver.Chrome(options=chrome_options) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py”, line 45, in __init__ super().__init__( File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py”, line 61, in __init__ super().__init__(command_executor=executor, options=options) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 209, in __init__ self.start_session(capabilities) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 293, in start_session response = self.execute(Command.NEW_SESSION, caps)[“value”] File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 348, in execute self.error_handler.check_response(response) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py”, line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: Chrome failed to start: exited normally. (session not created: DevToolsActivePort file doesn’t exist) (The process started from chrome location /home/ec-server/.cache/selenium/chrome/linux64/123.0.6312.86/chrome is no longer running, so ChromeDriver is assuming that Chrome has crashed.) Stacktrace: #0 0x55fe444e88a3 <unknown> #1 0x55fe441de8c6 <unknown> #2 0x55fe44212d34 <unknown> #3 0x55fe4420ed3d <unknown> #4 0x55fe44257aed <unknown> #5 0x55fe4424b343 <unknown> #6 0x55fe4421c593 <unknown> #7 0x55fe4421cf5e <unknown> #8 0x55fe444ac88b <unknown> #9 0x55fe444b07e5 <unknown> #10 0x55fe4449a5b1 <unknown> #11 0x55fe444b1372 <unknown> #12 0x55fe4447f8bf <unknown> #13 0x55fe444d7768 <unknown> #14 0x55fe444d793b <unknown> #15 0x55fe444e79f4 <unknown> #16 0x7f6fe2f2a609 start_thread
このエラーメッセージは、Chromeが起動できないために発生しています。ChromeDriverがChromeを正常に起動できない理由はさまざまですが、一般的な原因は次のとおりです:
ChromeバージョンとChromeD ...
bashで
Bashシェルを使用してファイルをコピーする方法は、cpコマンドを使用することです。
bashcp/path/to/source/file/path/to/destination/
上記のコマンドでは、/path/ ...
ファイルをコピーしたい
ファイルをコピーする方法は、使用しているオペレーティングシステムや環境によって異なります。以下では、一般的な方法をいくつか紹介します。
Windowsの場合:Windowsの場合、shutilモジュールを使用してファイルを ...
————————————————————————— AttributeError Traceback (most recent call last) File ~anaconda3libsite-packagesseleniumwebdrivercommondriver_finder.py:38, in DriverFinder.get_path(service, options) 37 try: —> 38 path = SeleniumManager().driver_location(options) if path is None else path 39 except Exception as err: File ~anaconda3libsite-packagesseleniumwebdrivercommonselenium_manager.py:87, in SeleniumManager.driver_location(self, options) 80 “””Determines the path of the correct driver. 81 82 :Args: 83 – browser: which browser to get the driver path for. 84 :Returns: The driver path to use 85 “”” —> 87 browser = options.capabilities[“browserName”] 89 args = [str(self.get_binary()), “–browser”, browser] AttributeError: ‘str’ object has no attribute ‘capabilities’ During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) Cell In[1], line 5 2 from webdriver_manager.chrome import ChromeDriverManager 4 # ChromeDriverをインストールしてWebDriverを設定 —-> 5 driver = webdriver.Chrome(ChromeDriverManager().install()) File ~anaconda3libsite-packagesseleniumwebdriverchromewebdriver.py:45, in WebDriver.__init__(self, options, service, keep_alive) 42 service = service if service else Service() 43 options = options if options else Options() —> 45 super().__init__( 46 browser_name=DesiredCapabilities.CHROME[“browserName”], 47 vendor_prefix=”goog”, 48 options=options, 49 service=service, 50 keep_alive=keep_alive, 51 ) File ~anaconda3libsite-packagesseleniumwebdriverchromiumwebdriver.py:49, in ChromiumDriver.__init__(self, browser_name, vendor_prefix, options, service, keep_alive) 37 “””Creates a new WebDriver instance of the ChromiumDriver. Starts the 38 service and then creates new WebDriver instance of ChromiumDriver. 39 (…) 45 – keep_alive – Whether to configure ChromiumRemoteConnection to use HTTP keep-alive. 46 “”” 47 self.service = service —> 49 self.service.path = DriverFinder.get_path(self.service, options) 50 self.service.start() 52 executor = ChromiumRemoteConnection( 53 remote_server_addr=self.service.service_url, 54 browser_name=browser_name, (…) 57 ignore_proxy=options._ignore_local_proxy, 58 ) File ~anaconda3libsite-packagesseleniumwebdrivercommondriver_finder.py:40, in DriverFinder.get_path(service, options) 38 path = SeleniumManager().driver_location(options) if path is None else path 39 except Exception as err: —> 40 msg = f”Unable to obtain driver for {options.capabilities[‘browserName’]} using Selenium Manager.” 41 raise NoSuchDriverException(msg) from err 43 if path is None or not Path(path).is_file(): AttributeError: ‘str’ object has no attribute ‘capabilities’
このエラーは、ChromeDriverManager().install()を使用してChromeDriverをインストールしようとしたときに発生しています。エラーメッセージから、Selenium Managerがオプションオブジェク ...
from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager # ChromeDriverをインストールしてWebDriverを設定 driver = webdriver.Chrome(ChromeDriverManager().install())
提供されたコードは、Seleniumライブラリを使用してChromeDriverをインストールし、WebDriverを設定してChromeブラウザを起動するものです。ChromeDriverManagerを使用することで、Chrome ...
driver = webdriver.Chrome(ChromeDriverManager().install()) これをつかいたい
提供されたコード driver = webdriver.Chrome(ChromeDriverManager().install()) は、ChromeDriverManagerを使用してChromeDriverをインストールおよび設 ...
————————————————————————— AttributeError Traceback (most recent call last) File ~anaconda3libsite-packagesseleniumwebdrivercommondriver_finder.py:38, in DriverFinder.get_path(service, options) 37 try: —> 38 path = SeleniumManager().driver_location(options) if path is None else path 39 except Exception as err: File ~anaconda3libsite-packagesseleniumwebdrivercommonselenium_manager.py:87, in SeleniumManager.driver_location(self, options) 80 “””Determines the path of the correct driver. 81 82 :Args: 83 – browser: which browser to get the driver path for. 84 :Returns: The driver path to use 85 “”” —> 87 browser = options.capabilities[“browserName”] 89 args = [str(self.get_binary()), “–browser”, browser] AttributeError: ‘str’ object has no attribute ‘capabilities’ During handling of the above exception, another exception occurred: AttributeError Traceback (most recent call last) Cell In[167], line 14 8 chrome_options.add_argument(“–headless”) # headlessモードを有効にする 9 # ChromeDriverのパスを取得 10 # chrome_driver_path = ChromeDriverManager().install() 11 12 # ChromeDriverを起動 13 # driver = webdriver.Chrome(options=chrome_options) —> 14 driver = webdriver.Chrome(ChromeDriverManager().install()) 15 # options = webdriver.ChromeOptions() 16 # options.add_argument(“–headless”) # ヘッドレスモードでChromeを起動する場合 17 # driver = webdriver.Chrome(ChromeDriverManager().install()) 18 19 20 # ログイン 21 login(driver,login_url,login_id,login_pass) File ~anaconda3libsite-packagesseleniumwebdriverchromewebdriver.py:45, in WebDriver.__init__(self, options, service, keep_alive) 42 service = service if service else Service() 43 options = options if options else Options() —> 45 super().__init__( 46 browser_name=DesiredCapabilities.CHROME[“browserName”], 47 vendor_prefix=”goog”, 48 options=options, 49 service=service, 50 keep_alive=keep_alive, 51 ) File ~anaconda3libsite-packagesseleniumwebdriverchromiumwebdriver.py:49, in ChromiumDriver.__init__(self, browser_name, vendor_prefix, options, service, keep_alive) 37 “””Creates a new WebDriver instance of the ChromiumDriver. Starts the 38 service and then creates new WebDriver instance of ChromiumDriver. 39 (…) 45 – keep_alive – Whether to configure ChromiumRemoteConnection to use HTTP keep-alive. 46 “”” 47 self.service = service —> 49 self.service.path = DriverFinder.get_path(self.service, options) 50 self.service.start() 52 executor = ChromiumRemoteConnection( 53 remote_server_addr=self.service.service_url, 54 browser_name=browser_name, (…) 57 ignore_proxy=options._ignore_local_proxy, 58 ) File ~anaconda3libsite-packagesseleniumwebdrivercommondriver_finder.py:40, in DriverFinder.get_path(service, options) 38 path = SeleniumManager().driver_location(options) if path is None else path 39 except Exception as err: —> 40 msg = f”Unable to obtain driver for {options.capabilities[‘browserName’]} using Selenium Manager.” 41 raise NoSuchDriverException(msg) from err 43 if path is None or not Path(path).is_file(): AttributeError: ‘str’ object has no attribute ‘capabilities’
このエラーは、ChromeDriverManagerがSelenium Managerを使用してChromeDriverのパスを取得しようとする際に発生しています。このエラーは、Selenium Managerがoptionsオブジェ ...
<div class=”app-sign-in-register__content-inner”><h1>Sign in to Jenkins</h1><form method=”post” name=”login” action=”j_spring_security_check”><div><label class=”app-sign-in-register__form-label” for=”j_username”>ユーザー名</label><input autocorrect=”off” autocomplete=”off” name=”j_username” id=”j_username” type=”text” autofocus=”autofocus” class=”jenkins-input ” autocapitalize=”off”></div><div><label class=”app-sign-in-register__form-label” for=”j_password”>パスワード</label><input name=”j_password” id=”j_password” type=”password” class=”jenkins-input “></div><div class=”jenkins-checkbox”><input type=”checkbox” id=”remember_me” name=”remember_me”><label for=”remember_me”>サインインしたままにする</label></div><input name=”from” type=”hidden” value=”/”><button type=”submit” name=”Submit” class=”jenkins-button jenkins-button–primary”>サインイン</button></form><div class=”footer”></div></div> 要素あってるよね?
はい、提供されたHTMLコードには、ユーザー名とパスワードの入力フィールドがそれぞれ正しいIDで定義されています。ユーザー名の入力フィールドのIDは”j_username”であり、パスワードの入力フィールドのI ...
def login(driver,login_url,login_id,login_pass): driver.get(login_url) sleep(5) driver.find_element(By.ID,”j_username”).clear() sleep(2) driver.find_element(By.ID,”j_username”).send_keys(login_id)#ログインIDを入力 sleep(2) driver.find_element(By.ID,”j_password”).clear() sleep(2) driver.find_element(By.ID,”j_password”).send_keys(login_pass)#ログインPASSを入力 sleep(2) driver.find_element(By.CLASS_NAME,”jenkins-button”).click()
提供されたログイン関数は、指定されたURLにアクセスし、指定されたログインIDとパスワードを使用してログインするものです。ただし、エラーが発生する可能性があります。以下の点に注意してください:
ログインフォームが表示される ...
メッセージが送信されました。 Traceback (most recent call last): File “Jenkins_buld.py”, line 75, in <module> login(driver,login_url,login_id,login_pass) File “Jenkins_buld.py”, line 24, in login driver.find_element(By.ID,”j_username”).clear() File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 742, in find_element return self.execute(Command.FIND_ELEMENT, {“using”: by, “value”: value})[“value”] File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 348, in execute self.error_handler.check_response(response) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py”, line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:”css selector”,”selector”:”[id=”j_username”]”} (Session info: chrome-headless-shell=120.0.6099.216); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: #0 0x55a0d4cf5f83 <unknown>
エラーの内容から判断すると、driver.find_element(By.ID, "j_username")で指定されたIDの要素が見つからないようです。このエラーは、要素がまだ読み込まれていないか、指定されたIDが正しくない場合に発 ...
(venv) ec-server@ecserver:/home/share/jenkins_build$ python3 Jenkins_buld.py メッセージが送信されました。 Traceback (most recent call last): File “Jenkins_buld.py”, line 75, in <module> login(driver,login_url,login_id,login_pass) File “Jenkins_buld.py”, line 24, in login driver.find_element(By.ID,”j_username”).clear() File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 742, in find_element return self.execute(Command.FIND_ELEMENT, {“using”: by, “value”: value})[“value”] File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py”, line 348, in execute self.error_handler.check_response(response) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py”, line 229, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {“method”:”css selector”,”selector”:”[id=”j_username”]”} (Session info: chrome-headless-shell=120.0.6099.216); For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception Stacktrace: #0 0x55bdca6a3f83 <unknown> #1 0x55bdca35ccf7 <unknown> #2 0x55bdca3ac99e <unknown> #3 0x55bdca3acaa1 <unknown> #4 0x55bdca3f7d64 <unknown> #5 0x55bdca3d60dd <unknown> #6 0x55bdca3f5006 <unknown> #7 0x55bdca3d5e53 <unknown> #8 0x55bdca39ddd4 <unknown> #9 0x55bdca39f1de <unknown> #10 0x55bdca668531 <unknown> #11 0x55bdca66c455 <unknown> #12 0x55bdca654f55 <unknown> #13 0x55bdca66d0ef <unknown> #14 0x55bdca63899f <unknown> #15 0x55bdca691008 <unknown> #16 0x55bdca6911d7 <unknown> #17 0x55bdca6a3124 <unknown> #18 0x7fd740016609 start_thread
このエラーは、指定されたID(”j_username”)を持つ要素が見つからないために発生しています。このようなエラーは、要素がまだページに読み込まれていないか、指定された方法で要素を特定できない場合に発生しま ...
Traceback (most recent call last): File “Jenkins_buld.py”, line 68, in <module> driver = webdriver.Chrome(ChromeDriverManager().install()) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/chrome/webdriver.py”, line 45, in __init__ super().__init__( File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/chromium/webdriver.py”, line 49, in __init__ self.service.path = DriverFinder.get_path(self.service, options) File “/home/share/jenkins_build/venv/lib/python3.8/site-packages/selenium/webdriver/common/driver_finder.py”, line 40, in get_path msg = f”Unable to obtain driver for {options.capabilities[‘browserName’]} using Selenium Manager.” AttributeError: ‘str’ object has no attribute ‘capabilities’
このエラーは、webdriver.Chrome()コンストラクタに渡されたオプションが適切ではないことを示しています。webdriver.Chrome()に渡すべきオプションは、webdriver.ChromeOptions()のイン ...
ChromeDriverManager().install() これつかってseleniumを起動させたい
ChromeDriverManager().install()はPythonのwebdriver_managerライブラリを使用して、ChromeDriverを自動的にダウンロードおよびインストールするためのコードです。このコードを使 ...
GoogleのBigqueryってなに
GoogleのBigQuery(ビッグクエリ)は、クラウドベースのデータウェアハウスサービスであり、大規模なデータセットの分析を行うためのマネージドサービスです。BigQueryは、Google Cloud Platform(GCP) ...
サーバーレス データ ウェアハウスってなに
サーバーレスデータウェアハウスは、データウェアハウスの一種であり、従来のデータウェアハウスとは異なるアーキテクチャを持つものです。通常のデータウェアハウスでは、データの処理と格納に専用のハードウェアやサーバーが必要ですが、サーバーレス ...
ジニ不純度について詳しく
ジニ不純度(Gini impurity)は、分類タスクにおける不純度を測る指標の一つです。分割されたデータが「異なるクラスの要素をどれだけ混在しているか」を表す指標であり、0から1の値を取ります。0は最も純粋な状態(全ての要素が同じク ...