前提・実現したいこと
Beautifulsoupをインストールしたい
発生している問題・エラーメッセージ
Requirement already satisfied: gspread in /usr/local/lib/python3.6/dist-packages (3.0.1) Requirement already satisfied: requests>=2.2.1 in /usr/local/lib/python3.6/dist-packages (from gspread) (2.23.0) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests>=2.2.1->gspread) (2020.12.5) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests>=2.2.1->gspread) (3.0.4) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests>=2.2.1->gspread) (1.24.3) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests>=2.2.1->gspread) (2.10) Requirement already satisfied: requests in /usr/local/lib/python3.6/dist-packages (2.23.0) Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.6/dist-packages (from requests) (2.10) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.6/dist-packages (from requests) (2020.12.5) Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.6/dist-packages (from requests) (3.0.4) Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in /usr/local/lib/python3.6/dist-packages (from requests) (1.24.3) Requirement already satisfied: bs4 in /usr/local/lib/python3.6/dist-packages (0.0.1) Requirement already satisfied: beautifulsoup4 in /usr/local/lib/python3.6/dist-packages (from bs4) (4.6.3) Requirement already satisfied: oauth2client in /usr/local/lib/python3.6/dist-packages (4.1.3) Requirement already satisfied: pyasn1-modules>=0.0.5 in /usr/local/lib/python3.6/dist-packages (from oauth2client) (0.2.8) Requirement already satisfied: rsa>=3.1.4 in /usr/local/lib/python3.6/dist-packages (from oauth2client) (4.6) Requirement already satisfied: six>=1.6.1 in /usr/local/lib/python3.6/dist-packages (from oauth2client) (1.15.0) Requirement already satisfied: pyasn1>=0.1.7 in /usr/local/lib/python3.6/dist-packages (from oauth2client) (0.4.8) Requirement already satisfied: httplib2>=0.9.1 in /usr/local/lib/python3.6/dist-packages (from oauth2client) (0.17.4) --2021-01-12 13:55:59-- https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb Resolving dl.google.com (dl.google.com)... 108.177.119.136, 108.177.119.190, 108.177.119.93, ... Connecting to dl.google.com (dl.google.com)|108.177.119.136|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 77271596 (74M) [application/x-debian-package] Saving to: ‘google-chrome-stable_current_amd64.deb.24’ google-chrome-stabl 100%[===================>] 73.69M 221MB/s in 0.3s 2021-01-12 13:56:00 (221 MB/s) - ‘google-chrome-stable_current_amd64.deb.24’ saved [77271596/77271596] Reading package lists... Done Building dependency tree Reading state information... Done Note, selecting 'google-chrome-stable' instead of './google-chrome-stable_current_amd64.deb' google-chrome-stable is already the newest version (87.0.4280.141-1). 0 upgraded, 0 newly installed, 0 to remove and 16 not upgraded. src/tcmalloc.cc:283] Attempt to free invalid pointer 0x34acae46da20 mkdir: cannot create directory ‘/usr/local/chromedriver’: File exists mv: cannot stat 'chromedriver': No such file or directory chmod: cannot access '/usr/local/chromedriver/chromedriver': No such file or directory Requirement already satisfied: selenium in /usr/local/lib/python3.6/dist-packages (3.141.0) Requirement already satisfied: urllib3 in /usr/local/lib/python3.6/dist-packages (from selenium) (1.24.3) --------------------------------------------------------------------------- ImportError Traceback (most recent call last) <ipython-input-27-dea06cef90dc> in <module>() 31 32 # HTMLから必要な情報を得る為にBeautifulSoupをimport ---> 33 from bs4 import beautifulsoup 34 # グーグルスプレッドシートを操作する為にimport 35 import gspread ImportError: cannot import name 'beautifulsoup' --------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt. To view examples of installing some common dependencies, click the "Open Examples" button below. ---------------------------------------------------------------------------
該当のソースコード
python3
1!pip install gspread 2!pip install requests 3!pip install bs4 4#!sudo apt-get install python3-bs4 5#!sudo apt-get install python3-requests 6#!cat /etc/ssl/certs/ca-certificates.crt 7#!sudo update-ca-certificates 8!pip install oauth2client 9#!pip3 list 10 11!wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb 12!sudo apt install ./google-chrome-stable_current_amd64.deb 13!google-chrome -version 14!sudo mkdir /usr/local/chromedriver 15!sudo mv chromedriver /usr/local/chromedriver 16!sudo chmod ugo+x /usr/local/chromedriver/chromedriver 17!pip install selenium 18 19 20# ブラウザを自動操作するためseleniumをimport 21from selenium import webdriver 22 23# seleniumでヘッドレスモードを指定するためにimport 24from selenium.webdriver.chrome.options import Options 25 26# seleniumでEnterキーを送信する際に使用するのでimport 27from selenium.webdriver.common.keys import Keys 28 29# HTTPリクエストを送る為にrequestsをimport 30import requests 31 32# HTMLから必要な情報を得る為にBeautifulSoupをimport 33from bs4 import beautifulsoup 34# グーグルスプレッドシートを操作する為にimport 35import gspread 36# グーグルスプレッドシートの認証情報設定の為にimport 37from oauth2client.server_account import ServiceAccountCredentials 38
試したこと
#!sudo apt-get install python3-bs4 #!sudo apt-get install python3-requests #!cat /etc/ssl/certs/ca-certificates.crt #!sudo update-ca-certificates
いろいろなサイトを見て以上のように入れて試験してみましたが解決しませんでした。
補足情報(FW/ツールのバージョンなど)
Chromebook
Googlecolab
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2021/01/13 00:43
2021/01/13 00:58
2021/01/13 01:03