gpt4 book ai didi

swift 从终端抛出 python 错误

转载 作者:行者123 更新时间:2023-11-28 07:45:53 24 4
gpt4 key购买 nike

每当我尝试启动与 python 相关的 swift 时,我都会收到错误消息。我该如何解决这个问题?

bash-3.2$ swift --version
Apple Swift version 4.1 (swiftlang-902.0.48 clang-902.0.37.1)
Target: x86_64-apple-darwin17.5.0
bash-3.2$ swift
Traceback (most recent call last):
File "", line 1, in
File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/copy.py", line 52, in
import weakref
File "/usr/local/Cellar/python@2/2.7.14_3/Frameworks/Python.framework/Versions/2.7/lib/python2.7/weakref.py", line 14, in
from _weakref import (
ImportError: cannot import name _remove_dead_weakref

最佳答案

我得到同样的错误,因为 swift REPL 使用自制程序安装在 /usr/local/bin/python 的 python 解释器。

为了避免这种情况,你可以

export PATH=/usr/bin:$PATH
swift

PATH=/usr/bin:$PATH swift

关于swift 从终端抛出 python 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51079770/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com