python-3.x - 无法在 python 可执行文件中执行 VBoxManage 命令(使用 pyinstaller 创建)
问题描述
操作系统:Ubuntu 16.04 LTS
使 install.py 文件可执行:
pyinstaller -w install.py --onefile
install.py 脚本:
import os
VM = os.system('VBoxManage startvm win10 --type headless')
if VM == 0:
print("win10 started...")
else:
print("win10 not started....")
问题:当我python3 install.py
在 ubuntu 终端上运行时,它工作正常。之后,我使用上面提到的命令创建了一个可执行文件,当我通过给出命令在终端上执行可执行文件时chmod 777 install & ./install
。它在下面给出一个错误:
错误:
VBoxManage: error: Failed to create the VirtualBox object!
VBoxManage: error: Code NS_ERROR_FACTORY_NOT_REGISTERED (0x80040154) - Class not registered (extended info not available)
VBoxManage: error: Most likely, the VirtualBox COM server is not running or failed to start.
我不知道出了什么问题 python 脚本可以正常工作,但是当我创建它的可执行文件时,它每次都会给出相同的错误。
提前致谢。
解决方案
推荐阅读
- javascript - 如何使 jQuery 表格单元格(td)可单击以运行函数?
- ios - UITableViewCell 高度:通过添加项目,动态增加高度
- cmake - cmake configure_file 未正确扩展 mylib.pc.in
- python-3.x - 用 Python 和 Beautiful Soup 抓取 div 的问题
- python - 不同页面上的 Webscraping 表
- xhtml - W3C XHTML 1.0 Validator - 是否添加了对属性“Integrity”和“Crossorigin”的支持?
- css - 如何在环绕浮动元素的视口中垂直居中文本
- r - R;对于百万向量的循环太慢了
- android - 安装flutter时如何修复“在此位置找不到Android SDK”错误?
- java - 为什么需要使用 new Random() 而不仅仅是 Random Randomnum?