【发布时间】:2020-05-26 15:21:34
【问题描述】:
我想通过在 Linux 中双击创建一个可运行的 .py 应用程序。 首先,我尝试了一个简单的例子:
#!/usr/bin/env python3
import cv2
img= cv2.imread('/home/andrei/WTZ/code/Computer-Vision-with-Python/DATA/test_image.jpg')
cv2.imshow('It works?', img)
cv2.waitKey(0)
cv2.destroyAllWindows()
它只是打开一个图像,没什么特别的。 我安装了 pyinstaller 并在终端中运行了以下命令:
pyinstaller --onefile --add-data="/home/andrei/WTZ/code/Computer-Vision-with-Python/DATA/test.jpg;/home/andrei/WTZ/code/Computer-Vision-with-Python/DATA/test.jpg" test.py
我遇到以下错误:
pyinstaller: error: argument --add-data: invalid add_data_or_binary value: '/home/andrei/WTZ/code/Computer-Vision-with-Python/DATA/test.jpg;/home/andrei/WTZ/code/Computer-Vision-with-Python/DATA/test.jpg'
我做错了什么?
【问题讨论】:
-
或许可以试试
--add-binary? -
哦,如果我理解正确的话,DEST 是一个 relative 到 dist 路径的路径。
标签: python linux pyinstaller executable