我正试图在Mac上构建Pyodide,并且遇到了一个似乎是我默认的python安装的问题。我已经尝试过解决方案here,但是在使用makefile构建时仍然会出现以下错误:
stg-MBP:pyodide stg$ make
make -C packages
../bin/pyodide buildall . ../build \
--ldflags="-O3 -s "BINARYEN_METHOD='native-wasm'" -Werror -s
EMULATED_FUNCTION_POINTERS=1 -s EMULATE_FUNCTION_POINTER_CASTS=1 -s
SIDE_MODULE=1 -s WASM=1 -s "BINARYEN_TRAP_MODE='clamp'" --memory-init-
file 0" --
host=/Users/stg/workspaces/pyodide/cpython/build/3.7.0/host
--target=/Users/stg/workspaces/pyodide/cpython/installs/python-3.7.0
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named pathlib
/usr/bin/python: No module named pyodide_build
make[1]: *** [all] Error 1我的.bash_profile只包含以下几行:
alias python=python3
# Setting PATH for Python 3.7
PATH="/Library/Frameworks/Python.framework/Versions/3.7/bin:${PATH}"
export PATH但是,终端返回以下对这些命令的响应
stg-MBP:pyodide stg$ which python
/usr/bin/python
stg-MBP:pyodide stg$ python --version
Python 3.7.0
stg-MBP:pyodide stg$ python
Python 3.7.0 (v3.7.0:1bf9cc5093, Jun 26 2018, 23:26:24)
[Clang 6.0 (clang-600.0.57)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>>
stg-MBP:pyodide stg$ alias
alias python='python3'我已经尝试过清除哈希表并重新启动终端,但是我仍然找不到python3而不是python2 (我假设罪魁祸首是which python仍然返回系统python而不是python3)。是否有方法使makefile指向正确的python3安装,至少对于当前终端会话是这样的?
发布于 2018-10-06 05:38:49
.bash_profile仅由登录shell计算,别名不由子shell继承,因此在Pyodide构建运行时别名不活动。
您要么需要在构建树中编辑bin/pyoide,要么可以在目录中的名称python下放置一个指向python3的符号链接,并将该目录添加到PATH的前面,如下所示:
PATH="/path/to/directory-with-symbolic-link:$PATH" make这样,python将调用Python3解释器,因为PATH是由子subshells继承的。
https://stackoverflow.com/questions/52675438
复制相似问题