Linux上的独立python代码

时间:2018-06-07 11:32:37

标签: python linux pyinstaller

我有简单的python代码打印hello(hello.py),我希望使用pyinstaller使其可执行,以便在Linux上运行。

我应用命令pyinstaller hello.py,最终得到一个充满错误消息的屏幕:

6204 INFO: Building PKG (CArchive) out00-PKG.pkg completed successfully.
6205 INFO: Bootloader /home/nour/.local/lib/python3.5/site-packages/PyInstaller/bootloader/Linux-64bit/run
6206 INFO: checking EXE
6206 INFO: Building EXE because out00-EXE.toc is non existent
6206 INFO: Building EXE from out00-EXE.toc
6206 INFO: Appending archive to ELF section in EXE /home/nour/python/build/hello/hello
Traceback (most recent call last):
  File "/home/nour/.local/bin/pyinstaller", line 9, in <module>
    load_entry_point('PyInstaller==3.3.1', 'console_scripts', 'pyinstaller')()
  File "/home/nour/.local/lib/python3.5/site-packages/PyInstaller/__main__.py", line 94, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/home/nour/.local/lib/python3.5/site-packages/PyInstaller/__main__.py", line 46, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/home/nour/.local/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 791, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/home/nour/.local/lib/python3.5/site-packages/PyInstaller/building/build_main.py", line 737, in build
    exec(text, spec_namespace)
  File "<string>", line 26, in <module>
  File "/home/nour/.local/lib/python3.5/site-packages/PyInstaller/building/api.py", line 420, in __init__
    self.__postinit__()
  File "/home/nour/.local/lib/python3.5/site-packages/PyInstaller/building/datastruct.py", line 161, in __postinit__
    self.assemble()
  File "/home/nour/.local/lib/python3.5/site-packages/PyInstaller/building/api.py", line 574, in assemble
    self.name)
  File "/home/nour/.local/lib/python3.5/site-packages/PyInstaller/compat.py", line 517, in exec_command_all
    stdout=subprocess.PIPE, stderr=subprocess.PIPE, **kwargs)
  File "/usr/lib64/python3.5/subprocess.py", line 676, in __init__
    restore_signals, start_new_session)
  File "/usr/lib64/python3.5/subprocess.py", line 1282, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'objcopy'

我的hello.py是:

#!/usr/bin/python3.5
#!/usr/bin/env python3.5

def welcome():
    print('Welcome')

welcome()

我试图将python3.5更改为python3和python而没有任何成功

1 个答案:

答案 0 :(得分:0)

问题消失了一周左右,没有任何改变