- 親環境で
boto3
をインストールする
- その python インタプリタで venv 環境を作る
- venv 環境を activate する
boto3
はインストールされていない
❯ docker run -it --rm python:latest bash
root@830e7cd7026e:/# which python
/usr/local/bin/python
root@830e7cd7026e:/# python -V
Python 3.9.0
root@830e7cd7026e:/# pip install boto3
Collecting boto3
Downloading boto3-1.16.13-py2.py3-none-any.whl (129 kB)
|████████████████████████████████| 129 kB 2.0 MB/s
Collecting jmespath<1.0.0,>=0.7.1
Downloading jmespath-0.10.0-py2.py3-none-any.whl (24 kB)
Collecting botocore<1.20.0,>=1.19.13
Downloading botocore-1.19.13-py2.py3-none-any.whl (6.7 MB)
|████████████████████████████████| 6.7 MB 13.3 MB/s
Collecting s3transfer<0.4.0,>=0.3.0
Downloading s3transfer-0.3.3-py2.py3-none-any.whl (69 kB)
|████████████████████████████████| 69 kB 6.5 MB/s
Collecting python-dateutil<3.0.0,>=2.1
Downloading python_dateutil-2.8.1-py2.py3-none-any.whl (227 kB)
|████████████████████████████████| 227 kB 7.1 MB/s
Collecting urllib3<1.26,>=1.25.4; python_version != "3.4"
Downloading urllib3-1.25.11-py2.py3-none-any.whl (127 kB)
|████████████████████████████████| 127 kB 11.4 MB/s
Collecting six>=1.5
Downloading six-1.15.0-py2.py3-none-any.whl (10 kB)
Installing collected packages: jmespath, six, python-dateutil, urllib3, botocore, s3transfer, boto3
Successfully installed boto3-1.16.13 botocore-1.19.13 jmespath-0.10.0 python-dateutil-2.8.1 s3transfer-0.3.3 six-1.15.0 urllib3-1.25.11
root@830e7cd7026e:/# python -c 'import boto3; print(boto3.__version__)'
1.16.13
root@830e7cd7026e:/# python -m venv venv
root@830e7cd7026e:/# source ./venv/bin/activate
(venv) root@830e7cd7026e:/# which python
/venv/bin/python
(venv) root@830e7cd7026e:/# python -V
Python 3.9.0
(venv) root@830e7cd7026e:/# python -c 'import boto3; print(boto3.__version__)'
Traceback (most recent call last):
File "<string>", line 1, in <module>
ModuleNotFoundError: No module named 'boto3'
docs.python.org