我很好地使用了Python,Python3和aws-cli。但是,通过kyoto-cabinet
安装brew
后,我看到了cleanup not done in 30 days, running brew cleanup now
消息,然后执行了brew clean。此后,我将无法使用aws cli。
我尝试了此解决方案(Broken references in Virtualenvs),但徒劳。
我的命令后面是错误:
➜ pallet-core git:(master) ✗ aws
dyld: Library not loaded: @executable_path/../.Python
Referenced from: /usr/local/aws/bin/python2.7
Reason: image not found
[1] 1474 abort aws
我的python2版本是:
➜ pallet-core git:(master) python2 --version
Python 2.7.16
也没有活动的virtualenv
。
➜ pallet-core git:(master) which python
/usr/bin/python
我希望aws cli能够正常运行。
答案 0 :(得分:2)
安装依赖项
sudo apt-get update sudo apt-get install make build-essential libssl-dev
zlib1g-dev libbz2-dev \ libreadline-dev libsqlite3-dev wget curl llvm
libncurses5-dev libncursesw5-dev \ xz-utils tk-dev libffi-dev liblzma-dev
https://github.com/pyenv/pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv echo 'export
PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc echo 'export
PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc echo -e 'if command -v pyenv
1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
安装pyenv-virtualenv https://github.com/pyenv/pyenv-virtualenv
git clone https://github.com/pyenv/pyenv-virtualenv.git $(pyenv
root)/plugins/pyenv-virtualenv echo 'eval "$(pyenv virtualenv-init -)"' >>
~/.bashrc
安装Python 要使用pyenv安装特定的python版本并将其设置为全局python,然后以所需的python版本运行以下替换:
pyenv install <python_version> pyenv global <python_version> pip install --
upgrade pip
要基于当前活动的python版本创建virtualenv,请执行以下操作: pyenv虚拟环境 在输入相关
时自动激活和停用virtualenv目录,然后在所需级别创建文件,例如在a。文件夹的.python-version根目录下,以激活存储库的虚拟环境。该文件应仅包含您要激活的virtualenv的名称。 安装AWS CLI http://docs.aws.amazon.com/cli/latest/userguide/installing.html
#Activate your virtualenv pyenv activate <virtualenv_name>
pip install awscli
Configure AWS CLI
http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html生成访问密钥:登录到AWS控制台在IAM中导航至您的用户生成您自己的访问密钥下载.csv在终端中运行以下命令:
aws configure
#When prompted enter the following: # - enter generated AWS Access Key ID #
- enter generated AWS Secret Access Key # - us-west-2 # - json