卸载anaconda后诗歌和python问题(Mac OS)

问题描述 投票:0回答:1

我最近卸载了 anaconda 并重新安装了它的 M1 版本,因为我之前错误地使用了它的 intel 版本(我遵循了官方指南)。

我有一些使用诗歌的项目,我之前使用

pip install poetry
安装在 conda 环境中。我想在新的 conda 环境中重复此过程,但收到以下错误消息:

Building wheels for collected packages: xattr
  Building wheel for xattr (pyproject.toml) ... error
  error: subprocess-exited-with-error
  
  × Building wheel for xattr (pyproject.toml) did not run successfully.
  │ exit code: 1
  ╰─> [21 lines of output]
      running bdist_wheel
      running build
      running build_py
      creating build
      creating build/lib.macosx-10.9-universal2-cpython-312
      creating build/lib.macosx-10.9-universal2-cpython-312/xattr
      copying xattr/lib_build.py -> build/lib.macosx-10.9-universal2-cpython-312/xattr
      copying xattr/compat.py -> build/lib.macosx-10.9-universal2-cpython-312/xattr
      copying xattr/lib.py -> build/lib.macosx-10.9-universal2-cpython-312/xattr
      copying xattr/__init__.py -> build/lib.macosx-10.9-universal2-cpython-312/xattr
      copying xattr/tool.py -> build/lib.macosx-10.9-universal2-cpython-312/xattr
      copying xattr/pyxattr_compat.py -> build/lib.macosx-10.9-universal2-cpython-312/xattr
      running build_ext
      generating cffi module 'build/temp.macosx-10.9-universal2-cpython-312/_lib.c'
      creating build/temp.macosx-10.9-universal2-cpython-312
      building '_lib' extension
      creating build/temp.macosx-10.9-universal2-cpython-312/build
      creating build/temp.macosx-10.9-universal2-cpython-312/build/temp.macosx-10.9-universal2-cpython-312
      clang -fno-strict-overflow -Wsign-compare -Wunreachable-code -fno-common -dynamic -DNDEBUG -g -O3 -Wall -arch arm64 -arch x86_64 -g -I/Library/Frameworks/Python.framework/Versions/3.12/include/python3.12 -c build/temp.macosx-10.9-universal2-cpython-312/_lib.c -o build/temp.macosx-10.9-universal2-cpython-312/build/temp.macosx-10.9-universal2-cpython-312/_lib.o
      xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
      error: command '/usr/bin/clang' failed with exit code 1
      [end of output]
  
  note: This error originates from a subprocess, and is likely not a problem with pip.
  ERROR: Failed building wheel for xattr
Failed to build xattr
ERROR: Could not build wheels for xattr, which is required to install pyproject.toml-based projects

我在输入

python --version
时也收到类似的错误消息:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

但是当我输入

python3 --version
时我得到:

Python 3.12.1

我注意到的另一件事是,当我执行

poetry
时,我得到以下输出,其中 sys.path 似乎指向不再存在的 python 版本(我现在在 anaconda3/lib 中有 python3.11 文件夹)

ould not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
Python path configuration:
  PYTHONHOME = (not set)
  PYTHONPATH = (not set)
  program name = '/Users/janek/Library/Application Support/pypoetry/venv/bin/python'
  isolated = 0
  environment = 1
  user site = 1
  import site = 1
  sys._base_executable = '/Users/janek/Library/Application Support/pypoetry/venv/bin/python'
  sys.base_prefix = '/Users/janek/anaconda3'
  sys.base_exec_prefix = '/Users/janek/anaconda3'
  sys.platlibdir = 'lib'
  sys.executable = '/Users/janek/Library/Application Support/pypoetry/venv/bin/python'
  sys.prefix = '/Users/janek/anaconda3'
  sys.exec_prefix = '/Users/janek/anaconda3'
  sys.path = [
    '/Users/janek/anaconda3/lib/python310.zip',
    '/Users/janek/anaconda3/lib/python3.10',
    '/Users/janek/anaconda3/lib/lib-dynload',
  ]
Fatal Python error: init_fs_encoding: failed to get the Python codec of the filesystem encoding
Python runtime state: core initialized
ModuleNotFoundError: No module named 'encodings'

Current thread 0x0000000201585240 (most recent call first):
  <no Python frame>

我真的不知道如何将所有这些点连接在一起,所以任何帮助将不胜感激。本质上,我希望能够再次安装诗歌并在我的项目中使用它。谢谢

python python-3.x macos anaconda python-poetry
1个回答
0
投票

第一个错误表明您缺少

xcrun
,请尝试通过运行
xcode-select --install
来(重新)安装 xcode,看看是否可以解决该问题。

© www.soinside.com 2019 - 2024. All rights reserved.