0
0

More than 3 years have passed since last update.

AWS Linux2でpython3をインストールする方法

Posted at

yumでインストール

以下のようにyumでインストールします。
sudoは管理者権限でコマンドを実行します。
python3のインストールはこれだけです。

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo yum install python3 -y

オプション -y は、以下のようなメッセージにすべてyで答えるために付けます。

Is this ok [y/d/N]:

モジュールのインストール

モジュールのインストールにはpip3コマンドを使用します。
オプション -V でpip3のバージョンを確認できます。

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ pip3 -V
pip 9.0.3 from /usr/lib/python3.7/site-packages (python 3.7)

ここではpandasをインストールしたいとします。(pandasをインストールしたいモジュールに置き換えてください)
・・・の部分は、表示されるメッセージを省略しています。

[ec2-user@ip-xxx-xxx-xxx-xxx ~]$ sudo pip3 install pandas
WARNING: Running pip install with root privileges is generally not a good idea. Try `pip3 install --user` instead.
Collecting pandas
・
・
・
Installing collected packages: pytz, numpy, six, python-dateutil, pandas
Successfully installed numpy-1.19.2 pandas-1.1.2 python-dateutil-2.8.1 pytz-2020.1 six-1.15.0

参考文献

AWS 公式ホームページ
https://aws.amazon.com/jp/premiumsupport/knowledge-center/ec2-linux-python3-boto3/

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0