加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

swift抛出终端的python错误

发布时间:2020-12-14 05:38:07 所属栏目:百科 来源:网络整理
导读:每当我尝试启动与 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): F
每当我尝试启动与 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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读