如何隐藏或相对于 conda-meta 文件夹内文件中出现的路径?
How to hide or make relative the paths that appear in the files inside the conda-meta folder?
像这样搭建conda环境时
conda create --prefix env python=3.6.5
conda-meta
文件夹中的某些 json 文件中出现了一些绝对路径。我怎样才能避免它?我只想在这里使用相对路径或者我只想完全隐藏它们。有没有办法做到这一点?它们是强制性的吗?请参阅 extracted_package_dir
、source
或 package_tarball_full_path
属性:
{
"arch": "x86_64",
"build": "py36_0",
"build_number": 0,
"channel": "https://repo.anaconda.com/pkgs/main/win-64",
"constrains": [],
"depends": [
"python >=3.6,<3.7.0a0"
],
"extracted_package_dir": "C:\Users\UserName\AppData\Local\conda\conda\pkgs\certifi-2019.3.9-py36_0",
"features": "",
"files": [
"Lib/site-packages/certifi-2019.03.09-py3.6.egg-info",
"Lib/site-packages/certifi/__init__.py",
"Lib/site-packages/certifi/__main__.py",
"Lib/site-packages/certifi/__pycache__/__init__.cpython-36.pyc",
"Lib/site-packages/certifi/__pycache__/__main__.cpython-36.pyc",
"Lib/site-packages/certifi/__pycache__/core.cpython-36.pyc",
"Lib/site-packages/certifi/cacert.pem",
"Lib/site-packages/certifi/core.py"
],
"fn": "certifi-2019.3.9-py36_0.tar.bz2",
"license": "ISC",
"link": {
"source": "C:\Users\UserName\AppData\Local\conda\conda\pkgs\certifi-2019.3.9-py36_0",
"type": 1
},
"md5": "e1faa30cf88c0cd141dfe71e70a9597a",
"name": "certifi",
"package_tarball_full_path": "C:\Users\UserName\AppData\Local\conda\conda\pkgs\certifi-2019.3.9-py36_0.tar.bz2",
"paths_data": {
"paths": [
[...]
如果我删除整个文件夹,环境将变得无用,我无法再激活它来安装、更新或删除新包。
我想这样做是为了将环境封装在一个应用程序中,我不想在最终用户的计算机中保留我原来的绝对路径。
我的用例
我正在开发一个使用龙卷风服务器的电子应用程序(使用 python)
目前我正在使用 electron-builder
将环境添加到安装程序并且工作得很好,但一个缺点是我在上面评论的 conda-meta
文件夹。我现在做的是当我想制作安装程序时手动删除它。
这可能会破坏 conda。它不是为了将它们视为相对路径而编写的。如果您告诉我们更多有关您的用例的信息,也许我们可以提供帮助。您是否要重新分发已安装的环境?您看到 "constructor" 或 "conda-pack" 项目了吗?
最后,我找到的最佳解决方案是在使用 electron-builder
创建最终安装程序时忽略该文件夹。
所以我应用了指令extraResources
to add the conda environment except the folder conda-meta
. And I have added the filter "!conda-meta${/*}"
, the meaning is explained here
Remember that !doNotCopyMe/**/*
would match the files in the doNotCopyMe
directory, but not the directory itself, so the empty directory would be created. Solution — use macro ${/*}
, e.g. !doNotCopyMe${/*}
.
package.json
文件中的结果:
"extraResources": [
{
"from": "../env",
"to": "env",
"filter": [
"**/*",
"!*.pyc",
"!conda-meta${/*}"
]
}
],
像这样搭建conda环境时
conda create --prefix env python=3.6.5
conda-meta
文件夹中的某些 json 文件中出现了一些绝对路径。我怎样才能避免它?我只想在这里使用相对路径或者我只想完全隐藏它们。有没有办法做到这一点?它们是强制性的吗?请参阅 extracted_package_dir
、source
或 package_tarball_full_path
属性:
{
"arch": "x86_64",
"build": "py36_0",
"build_number": 0,
"channel": "https://repo.anaconda.com/pkgs/main/win-64",
"constrains": [],
"depends": [
"python >=3.6,<3.7.0a0"
],
"extracted_package_dir": "C:\Users\UserName\AppData\Local\conda\conda\pkgs\certifi-2019.3.9-py36_0",
"features": "",
"files": [
"Lib/site-packages/certifi-2019.03.09-py3.6.egg-info",
"Lib/site-packages/certifi/__init__.py",
"Lib/site-packages/certifi/__main__.py",
"Lib/site-packages/certifi/__pycache__/__init__.cpython-36.pyc",
"Lib/site-packages/certifi/__pycache__/__main__.cpython-36.pyc",
"Lib/site-packages/certifi/__pycache__/core.cpython-36.pyc",
"Lib/site-packages/certifi/cacert.pem",
"Lib/site-packages/certifi/core.py"
],
"fn": "certifi-2019.3.9-py36_0.tar.bz2",
"license": "ISC",
"link": {
"source": "C:\Users\UserName\AppData\Local\conda\conda\pkgs\certifi-2019.3.9-py36_0",
"type": 1
},
"md5": "e1faa30cf88c0cd141dfe71e70a9597a",
"name": "certifi",
"package_tarball_full_path": "C:\Users\UserName\AppData\Local\conda\conda\pkgs\certifi-2019.3.9-py36_0.tar.bz2",
"paths_data": {
"paths": [
[...]
如果我删除整个文件夹,环境将变得无用,我无法再激活它来安装、更新或删除新包。
我想这样做是为了将环境封装在一个应用程序中,我不想在最终用户的计算机中保留我原来的绝对路径。
我的用例
我正在开发一个使用龙卷风服务器的电子应用程序(使用 python)
目前我正在使用 electron-builder
将环境添加到安装程序并且工作得很好,但一个缺点是我在上面评论的 conda-meta
文件夹。我现在做的是当我想制作安装程序时手动删除它。
这可能会破坏 conda。它不是为了将它们视为相对路径而编写的。如果您告诉我们更多有关您的用例的信息,也许我们可以提供帮助。您是否要重新分发已安装的环境?您看到 "constructor" 或 "conda-pack" 项目了吗?
最后,我找到的最佳解决方案是在使用 electron-builder
创建最终安装程序时忽略该文件夹。
所以我应用了指令extraResources
to add the conda environment except the folder conda-meta
. And I have added the filter "!conda-meta${/*}"
, the meaning is explained here
Remember that
!doNotCopyMe/**/*
would match the files in thedoNotCopyMe
directory, but not the directory itself, so the empty directory would be created. Solution — use macro${/*}
, e.g.!doNotCopyMe${/*}
.
package.json
文件中的结果:
"extraResources": [
{
"from": "../env",
"to": "env",
"filter": [
"**/*",
"!*.pyc",
"!conda-meta${/*}"
]
}
],