我在其中添加了一个新别名python3.3
,.bash_profile
以便轻松启动pyzopython3.3
版本。
我可以在终端中毫无问题地使用这个别名,但是当我使用类似的东西时subprocess.check_call(args = ["python3.3", onePyFile])
,我有以下错误。
Traceback (most recent call last):
...
File "/Library/Frameworks/pyzo2013b/lib/python3.3/subprocess.py", line 540, in check_call
retcode = call(*popenargs, **kwargs)
File "/Library/Frameworks/pyzo2013b/lib/python3.3/subprocess.py", line 521, in call
with Popen(*popenargs, **kwargs) as p:
File "/Library/Frameworks/pyzo2013b/lib/python3.3/subprocess.py", line 818, in __init__
restore_signals, start_new_session)
File "/Library/Frameworks/pyzo2013b/lib/python3.3/subprocess.py", line 1416, in _execute_child
raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'python3.3'
我想我的别名不是到处都能看到的。那么我该如何解决我的问题呢?建立自己的别名的好方法是什么?
如果我尝试subprocess.check_call(args = ["python3.3", onePyFile], shell = True)
,我有以下错误。
onePyFile.py: python3.3: command not found
Traceback (most recent call last):
File "mainFile.py", line 72, in <module>
shell = True
File "/Library/Frameworks/pyzo2013b/lib/python3.3/subprocess.py", line 545, in check_call
raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command '['python3.3', 'onePyFile.py']' returned non-zero exit status 127
如果我只使用subprocess.check_call(args = ["python3.3", onePyFile])
where 的第一行,onePyFile
则会#! /usr/bin/env python3.3
出现以下错误。
env: python3.3: No such file or directory
Traceback (most recent call last):
...
我认为我的问题更多是关于符号链接而不是 Python 调用。但我不知道出了什么问题。事实上,这是我第一次使用别名建立个人符号链接。