- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 Electron 应用程序使用python-shell运行python脚本。我已经将pythonPath设置为我的anaconda env,如下所示。当我运行该应用程序时,此方法可以找到,但是用 Electron 构建器打包该应用程序后,它显示以下错误:即使我在同一台PC上使用绝对路径,也找不到这样的文件或目录。
const {PythonShell} = require('python-shell');
const path = require('path');
const options = {
mode: 'text',
pythonPath: 'C:/Users/nauma/.conda/envs/YOLO/python.exe',
pythonOptions: ['-u'], // get print results in real-time
scriptPath: path.join(__dirname, '/build/engine/')
};
PythonShell.run('index.py', options, function (err, res) {
if (err) throw err;
console.log(res);
});
最佳答案
如果未设置pythonPath,则在Windows上为
"build": {
"appId": "angular_electron.id",
"extraFiles": [
{
"from": "resources/${os}",
"to": "Resources",
}
]
}
import { isPackaged } from 'electron-is-packaged';
const resourcesPath = isPackaged
? join(rootPath, './resources')
: join(rootPath, './resources', getPlatform());
pyshell.PythonShell.run('hello.py',
{pythonPath:join(resourcesPath,'/python-3.6.3-embed-amd64/python.exe'),scriptPath:join(resourcesPath,'/bin')},
function (err, results) {
if (err) throw err;
console.log('hello.py finished.');
console.log('results:', results);
});
关于python - Electron 建立后,python-shell的pythonPath不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61043441/
如何在 Geany 中添加新的 pythonpath?我在偏好设置/选项中缺少某些内容吗?我尝试将其添加到 .bashrc 中,但没有成功。 export PYTHONPATH=/mypath 我现在
我需要向我的 PYTHONPATH 添加一个新的目录位置,但问题是我在一个干净的新安装的系统 (Linux) 上,其中没有 PYTHONPATH尚未定义。我已经阅读并使用了 PYTHONPATH,我认
我有以下情况(通过以下命令验证): x 目录下已有 python 脚本文件 现有的 python 猫__init__.py归档在x x 添加到 PYTHONPATH登录用户和 sudo 均可用的变量
将该行放入 .bashrc(Mac 上为 .profile)中,工作目录位于该路径上。别管它,它不是。 export PYTHONPATH=$PYTHONPATH 我注意到带有该行的 shell 在其
我对 PyCharm 如何确定 Python 用于定位模块和包的路径感到困惑。 首先,当我取消选中设置时(在“Python 控制台”和我的运行配置中),我仍然在 sys.path 开头看到我的项目目录
标题真的说明了一切。当我运行脚本 ( ModuleNotFoundError: No module named ) 时,我的 PYTHONPATH 中的文件无法识别,但是当我在命令行中打开交互式提示
我想设置pythonpath,但它不适用于其他目录。 我的 bashrc: 导出 PYTHONPATH=/usr/lib/python2.7 导出 PYTHONPATH=$PYTHONPATH/pla
根据documentation , sys.path 在 Python 解释器 session 启动时从 PYTHONPATH 初始化。但是,就我而言,PYTHONPATH 变量为空。当我在终端中执行
我是一个长期的潜伏者,第一次发帖所以请保持温柔。 我已经使用 Python 几个月了,我一直在尝试安装一个名为 heatmap 的库。具体this fork .通过 zip 文件安装后,我可以很好地导
请帮助我理解这一点。在这里你可以看到我设置了 PYTHONPATH(它来 self 的 .bashrc) jean@klippie:~$ echo $PYTHONPATH :/home/jean/lo
环境:debian 4.0 python 2.4 我的“项目”安装在: /usr/lib/python2.4/site-packages/project. 但我想使用我的工作副本而不是位于以下位置的已
我正在考虑类似的事情 python3 my_script.py --pythonpath/path/to/some/necessary/modules 有这样的事情吗?我知道(我认为)Pycharm
关于 PYTHONPATH 和导入有很多类似的问题,但我没有找到我所需要的。 我有一个 git 存储库,其中包含一些 python 帮助程序脚本。这些脚本自然地组织在几个包中。像这样的东西: scri
我有一组脚本,它们是使用特定的 python 安装执行的(用第一行 # 设置!)。网络上有一些不同的 python 安装,不同的组有自己的设置和工作流程。一些组织指示人们在 shell 登录中修改 P
我一直在尝试按照这篇文章 Permanently add a directory to PYTHONPATH 上的建议将自定义目录添加到 PYTHONPATH .如果相关的话,我在 Mac 上使用 b
我正在运行一个显式设置 PYTHONPATH 以避免命名冲突的脚本。然而,即使我说 os.environ['PYTHONPATH'] = '',看起来系统仍然能够找到我在脚本之外“存在”的旧路径。 即
正在尝试运行 runsnake给 ImportError: No module named wx 打开 ipython 或 python session 似乎工作正常: >>> import wx >
我试图列出新安装的 Xubuntu 12.04 中已安装的软件包: for d in `echo "${PYTHONPATH}" | tr ':' '\n'`; do ls "${d}"; done
我正在和我的团队一起开发几个不同的 Python 包。假设我们有 ~/src/pkg1、~/src/pkg2 和 ~/src/pkg3。我们如何将这些添加到 PYTHONPATH 而无需我们每个人都管
我知道我可以让 Python 忽略 PYTHONPATH 如果我用 -E 标志启动它。 但是如何让 pip 安装的脚本有这个标志? 我尝试了代码的“脚本”和“console_scripts”部分,如果
我是一名优秀的程序员,十分优秀!