简体   繁体   English

如何解决“dyld:库未加载:@executable_path ..”错误

[英]How to resolve "dyld: Library not loaded: @executable_path.." error

I was trying to check the AWS-CLI version on my MAC OS X. And the below error hit back:我试图在我的 MAC OS X 上检查 AWS-CLI 版本。并且出现以下错误:

dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /usr/local/aws/bin/python
  Reason: image not found
Abort trap: 6

Any relevant inputs on how to fix this would be highly appreciated.任何有关如何解决此问题的相关意见将不胜感激。

It is a bug with awscli and it might be fixed with the next versions.这是 awscli 的一个错误,可能会在下一个版本中修复。 That's why, a best practices is to upgrade :这就是为什么,最佳实践是升级:

brew upgrade awscli

You must have messed up with the brew.你一定搞砸了酿造。 Try reinstalling it using: brew install awscli (followed by brew link awscli if needed).尝试使用以下命令重新安装它: brew install awscli (如果需要,可以使用brew link awscli )。

This error occurs because your virtual environment has broken symlinks.出现此错误是因为您的虚拟环境已损坏符号链接。 Here is a nice solution taken from tevino's fix_virtualenv gist :这是从tevino 的fix_virtualenv gist 中获取的一个很好的解决方案:

#!/usr/bin/env bash

ENV_PATH="$(dirname "$(dirname "$(which pip)")")"
SYSTEM_VIRTUALENV="$(which -a virtualenv|tail -1)"

BAD_ENV_PATHS="/usr/local"

echo "Ensure the root of the broken virtualenv:"
echo "    $ENV_PATH"

if [[ -z "$ENV_PATH" ]] || [[ "$ENV_PATH" = *"$BAD_ENV_PATHS"* ]]; then
    echo "The root path above doesn't seems to be a valid one."
    echo "Please make sure you ACTIVATED the broken virtualenv."
    echo "‼️  Exiting for your safety... (thanks @laymonk for reporting this)"
    exit 1
fi

read -p "‼️  Press Enter if you are not sure (y/N) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
    echo "♻️  Removing old symbolic links......"
    find "$ENV_PATH" -type l -delete -print
    echo "💫  Creating new symbolic links......"
    $SYSTEM_VIRTUALENV "$ENV_PATH"
    echo "🎉  Done!"
fi

Also, here is a similar question: Broken references in Virtualenvs .另外,这里有一个类似的问题: 在 Virtualenvs 中损坏的引用

After read the topic, It works for me:阅读主题后,它对我有用:

  1. Uninstall aws卸载 aws
$ sudo rm -rf /usr/local/aws
$ sudo rm /usr/local/bin/aws
  1. Reinstall it again重新安装一遍
    $ brew reinstall awscli

I had similar issue while installing awscli with homebrew on mac.我在 mac 上使用自制软件安装 awscli 时遇到了类似的问题。 So final approach was "brew uninstall python3" and reinstall awscli again.所以最后的方法是“brew uninstall python3”并再次重新安装awscli。

If you have already python ( python --version works. If not install it with brew install python ).如果你已经有 python ( python --version工作。如果没有安装它brew install python )。 It works for me:这个对我有用:

  1. Uninstall aws卸载 aws

     $ sudo rm -rf /usr/local/aws $ sudo rm /usr/local/bin/aws
  2. Install it again重新安装

    $ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip" $ unzip awscli-bundle.zip $ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws

I had it installed through curl, the regular way我通过常规方式通过 curl 安装了它

$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"

Then it stopped working complaining about not finding python2.7然后它停止工作,抱怨找不到python2.7

dyld: Library not loaded: @executable_path/../.Python
  Referenced from: /usr/local/aws/bin/python2.7
  Reason: image not found
Abort trap: 6

so I fixed it by following these steps (make sure you don't do this if you installed it through brew ):所以我按照以下步骤修复了它(如果你通过brew安装它,请确保你不要这样做):

$ sudo rm -rf /usr/local/aws
$ sudo rm /usr/local/bin/aws

Then I installed it using brew:然后我使用 brew 安装它:

$ brew upgrade
$ brew install awscli

It's possible to trigger this error by having a problem in your virtualenv.如果您的 virtualenv 出现问题,可能会触发此错误。 For example, I had an existing working virtualenv and ran brew install awscli and it broke my virtualenv with this error.例如,我有一个现有的工作 virtualenv 并运行brew install awscli并且它因此错误破坏了我的 virtualenv。 If that's the case, deleting and recreating your virtualenv (the same way you originally created it) should resolve the problem.如果是这种情况,删除并重新创建您的 virtualenv(与您最初创建它的方式相同)应该可以解决问题。 It did for me.它对我有用。

This work for me.这对我有用。

brew upgrade
brew uninstall aws-sam-cli
brew install aws-sam-cli

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

相关问题 dyld:库未加载:@executable_path/../.Python - dyld: Library not loaded: @executable_path/../.Python AWS SAM CLI 全新安装引发错误 - dyld:未加载库:@executable_path/../.Python - AWS SAM CLI Fresh install throws error - dyld: Library not loaded: @executable_path/../.Python macOS 11.6/Xcode 13 上的诗歌安装失败:dyld:未加载库:@executable_path/../Python3 - poetry install fails on macOS 11.6/Xcode 13: dyld: Library not loaded: @executable_path/../Python3 如何解决dyld:Myo的python包装器中的库未加载错误 - How to solve dyld: Library not loaded error in a python wrapper for a Myo MacOS 上的 Python“dyld:库未加载”- 错误 - Python on MacOS "dyld: Library not loaded" - error 解决 PyCharm python 错误 - dyld: 库未加载 - Resolving PyCharm python error - dyld: Library not loaded `dyld:Library not loaded`错误阻止virtualenv加载 - `dyld: Library not loaded` error preventing virtualenv from loading 由于dyld而运行sphinx时出错:库未加载:@ rpath / Python - error running sphinx due to dyld: Library not loaded: @rpath/Python dyld:在kivy安装中未加载库 - dyld: Library not loaded on kivy installation jupyter notebook(dyld:库未加载) - jupyter notebook (dyld: Library not loaded)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM