繁体   English   中英

在 Mac OS 上导入 boto3 错误

[英]import boto3 error on Mac OS

我正在尝试在我的 mac(高山脉 10.13.3)上安装 boto3 并尝试遵循: https : //github.com/boto/boto3 我之前已经使用自制软件安装了 python 3,但是当我尝试查看 pip --version 时,出现错误。 所以,我做到了

1) 修改.bash_profile添加

alias pip=pip3

2)验证

$ pip --version
pip 9.0.1 from /usr/local/lib/python3.6/site-packages (python 3.6)

3)

$ pip install boto3
Collecting boto3
  Downloading boto3-1.5.36-py2.py3-none-any.whl (128kB)
    100% |████████████████████████████████| 133kB 474kB/s
Collecting botocore<1.9.0,>=1.8.50 (from boto3)
  Downloading botocore-1.8.50-py2.py3-none-any.whl (4.1MB)
    100% |████████████████████████████████| 4.1MB 376kB/s
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in ./Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: docutils>=0.10 in ./Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in ./Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)
Installing collected packages: botocore, boto3
  Found existing installation: botocore 1.8.20
    Uninstalling botocore-1.8.20:
      Successfully uninstalled botocore-1.8.20
Successfully installed boto3-1.5.36 botocore-1.8.50

4)只是为了确保这没问题,我跑了

$ pip3 install boto3
Requirement already satisfied: boto3 in /usr/local/lib/python3.6/site-packages
Requirement already satisfied: jmespath<1.0.0,>=0.7.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: s3transfer<0.2.0,>=0.1.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from boto3)
Requirement already satisfied: botocore<1.9.0,>=1.8.50 in /usr/local/lib/python3.6/site-packages (from boto3)
Requirement already satisfied: docutils>=0.10 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: python-dateutil<3.0.0,>=2.1 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from botocore<1.9.0,>=1.8.50->boto3)
Requirement already satisfied: six>=1.5 in /Users/ond983/Library/Python/3.6/lib/python/site-packages (from python-dateutil<3.0.0,>=2.1->botocore<1.9.0,>=1.8.50->boto3)

5) 但是,现在当我在 Idle 中运行 import boto3 时,出现错误

import boto3
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import boto3
ModuleNotFoundError: No module named 'boto3'

我什至尝试更改.bash_profile路径,但没有奏效。 想法?

我只需将名称中带有“bolo”的所有包从 Python 3.7 文件夹复制到 Python 2.7 文件夹即可:

/usr/local/lib/python3.7/site-packages $ sudo cp -R boto* /Library/Python/2.7/site-packages/.

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM