emsdk python版本错误问题解决

前端时间接触webAssembly(地址),安装过程中遇到了这个问题收集下,
这个是因为你点上安装了 python3的原因

Traceback (most recent call last):
  File "./emsdk", line 803, in xcode_sdk_version
    return subprocess.check_output(['xcrun', '--show-sdk-version']).strip().split('.')
TypeError: a bytes-like object is required, not 'str'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./emsdk", line 2385, in <module>
    sys.exit(main())
  File "./emsdk", line 2368, in main
    success = tool.install()
  File "./emsdk", line 1351, in install
    success = tool.install()
  File "./emsdk", line 1361, in install
    success = build_llvm_tool(self)
  File "./emsdk", line 856, in build_llvm_tool
    if OSX and (not os.environ.get('LLVM_CMAKE_ARGS') or not 'HAVE_FUTIMENS' in os.environ.get('LLVM_CMAKE_ARGS')) and xcode_sdk_version() < [10,13]:
  File "./emsdk", line 805, in xcode_sdk_version
    return subprocess.checkplatform.mac_ver()[0].split('.')
AttributeError: module 'subprocess' has no attribute 'checkplatform'

遇到这个问题需要自己手动修改emsdk文件,总共有两处

subprocess.check_output(['xcrun', '--show-sdk-version']).strip().split('.')
#改成
subprocess.check_output(['xcrun', '--show-sdk-version']).decode('utf8').strip().split('.')
#搜索到
if OSX and 
#整行改成
if OSX and (not os.environ.get('LLVM_CMAKE_ARGS') or not 'HAVE_FUTIMENS' in os.environ.get('LLVM_CMAKE_ARGS')) and xcode_sdk_version() < ['10','13']:

大功告成
在这里插入图片描述
完整编译通过

如果你的终端设置了代理,可能需要在添加下面的代码

#emsdk里面
import ssl
ssl._create_default_https_context = ssl._create_unverified_context
发布了77 篇原创文章 · 获赞 5 · 访问量 3万+

猜你喜欢

转载自blog.csdn.net/uk_51/article/details/99823235
今日推荐