每当我尝试启动与
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/@L_301_2@.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解释器.
原文链接:https://www.f2er.com/swift/318596.html为了避免这种情况你可以
export PATH=/usr/bin:$PATH swift
要么
PATH=/usr/bin:$PATH swift