イタリックテキスト### 前提
- google colaboratory を使用
- パッケージのバージョンを更新して使用したい
- 使用したいバージョン: tweepy==4.12.1
- 現在のバージョン : tweepy==3.10.0
Python 3.8.10 Looking in indexes: https://pypi.org/simple, https://us-python.pkg.dev/colab-wheels/public/simple/ Requirement already satisfied: tweepy==4.12.1 in /usr/local/lib/python3.9/dist-packages (4.12.1) Requirement already satisfied: requests<3,>=2.27.0 in /usr/local/lib/python3.9/dist-packages (from tweepy==4.12.1) (2.28.2) Requirement already satisfied: requests-oauthlib<2,>=1.2.0 in /usr/local/lib/python3.9/dist-packages (from tweepy==4.12.1) (1.3.1) Requirement already satisfied: oauthlib<4,>=3.2.0 in /usr/local/lib/python3.9/dist-packages (from tweepy==4.12.1) (3.2.2) Requirement already satisfied: charset-normalizer<4,>=2 in /usr/local/lib/python3.9/dist-packages (from requests<3,>=2.27.0->tweepy==4.12.1) (3.0.1) Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.9/dist-packages (from requests<3,>=2.27.0->tweepy==4.12.1) (1.26.14) Requirement already satisfied: idna<4,>=2.5 in /usr/local/lib/python3.9/dist-packages (from requests<3,>=2.27.0->tweepy==4.12.1) (3.4) Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.9/dist-packages (from requests<3,>=2.27.0->tweepy==4.12.1) (2022.12.7) WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv 3.10.0
該当のソースコード
上のエラーコードは以下のコードを実行したときに出た
pip installをしているのに使用されない
!python3 --version !sudo pip install tweepy==4.12.1 import tweepy print(tweepy.__version__)
試したこと
pip installでバージョン指定
補足情報(FW/ツールのバージョンなど)
pip listを実行した場合は4.12.1になっている
Package Version ----------------------- -------------------- certifi 2022.12.7 charset-normalizer 3.0.1 dbus-python 1.2.16 distlib 0.3.6 GDAL 3.0.4 idna 3.4 oauthlib 3.2.2 pip 22.3.1 PyGObject 3.36.0 python-apt 2.0.0+ubuntu0.20.4.8 requests 2.28.2 requests-oauthlib 1.3.1 requests-unixsocket 0.2.0 screen-resolution-extra 0.0.0 setuptools 66.0.0 tweepy 4.12.1 <===目的のパッケージ urllib3 1.26.14 wheel 0.34.2 xkit 0.0.0
pip3 list でも同じ
Package Version ----------------------- -------------------- certifi 2022.12.7 charset-normalizer 3.0.1 dbus-python 1.2.16 distlib 0.3.6 GDAL 3.0.4 idna 3.4 oauthlib 3.2.2 pip 22.3.1 PyGObject 3.36.0 python-apt 2.0.0+ubuntu0.20.4.8 requests 2.28.2 requests-oauthlib 1.3.1 requests-unixsocket 0.2.0 screen-resolution-extra 0.0.0 setuptools 66.0.0 tweepy 4.12.1 urllib3 1.26.14 wheel 0.34.2 xkit 0.0.0

