如何将 pyinstaller 与 pipeline/pyenv 一起使用

2024-02-27

我正在尝试从我的 python 脚本中发送一个可执行文件,该脚本位于使用 pipelinev 的虚拟环境中,它再次依赖 pyenv 进行 python 版本控制。为此,我想要使用 pyinstaller。

我做了什么:

pipenv install pyinstaller 
pyinstaller --onefile my_script.py

Output:

40 INFO: PyInstaller: 3.5
40 INFO: Python: 3.6.9
41 INFO: Platform: Linux-4.15.0-65-generic-x86_64-with-debian-stretch-sid
42 INFO: wrote /home/matthaeus/cybathlon/planvec/qt_video_gui_example.spec
44 INFO: UPX is not available.
45 INFO: Extending PYTHONPATH with paths
['/home/matthaeus/cybathlon/planvec', '/home/matthaeus/cybathlon/planvec']
45 INFO: checking Analysis
45 INFO: Building Analysis because Analysis-00.toc is non existent
45 INFO: Initializing module dependency graph...
46 INFO: Initializing module graph hooks...
47 INFO: Analyzing base_library.zip ...
2786 INFO: running Analysis Analysis-00.toc
2801 INFO: Caching module hooks...
2805 INFO: Analyzing /home/matthaeus/cybathlon/planvec/qt_video_gui_example.py
3284 INFO: Processing pre-find module path hook   distutils
3285 INFO: distutils: retargeting to non-venv dir '/home/matthaeus/.pyenv/versions/3.6.9/lib/python3.6/distutils/__init__.py'
3972 INFO: Processing pre-safe import module hook   setuptools.extern.six.moves
4336 INFO: Processing pre-find module path hook   site
4337 INFO: site: retargeting to fake-dir '/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/fake-modules'
6327 INFO: Loading module hooks...
6328 INFO: Loading module hook "hook-numpy.core.py"...
6458 INFO: Loading module hook "hook-sysconfig.py"...
6464 INFO: Loading module hook "hook-PyQt5.QtCore.py"...
6534 INFO: Loading module hook "hook-scipy.py"...
6535 INFO: Loading module hook "hook-PyQt5.py"...
6549 WARNING: Hidden import "sip" not found!
6549 INFO: Loading module hook "hook-pkg_resources.py"...
6788 INFO: Processing pre-safe import module hook   win32com
7015 INFO: Loading module hook "hook-numpy.py"...
7015 INFO: Loading module hook "hook-cv2.py"...
7016 INFO: Loading module hook "hook-PyQt5.QtGui.py"...
7048 INFO: Loading module hook "hook-PyQt5.QtWidgets.py"...
7096 INFO: Loading module hook "hook-pydoc.py"...
7097 INFO: Loading module hook "hook-xml.py"...
7150 INFO: Loading module hook "hook-encodings.py"...
7203 INFO: Loading module hook "hook-setuptools.py"...
7423 WARNING: Hidden import "distutils.command.build_ext" not found!
7680 INFO: Looking for ctypes DLLs
7762 INFO: Analyzing run-time hooks ...
7769 INFO: Including run-time hook 'pyi_rth_pyqt5.py'
7770 INFO: Including run-time hook 'pyi_rth_pkgres.py'
7771 INFO: Including run-time hook 'pyi_rth_multiprocessing.py'
7785 INFO: Looking for dynamic libraries
9784 INFO: Looking for eggs
9784 INFO: Python library not in binary dependencies. Doing additional searching...
Traceback (most recent call last):
  File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/bin/pyinstaller", line 8, in <module>
    sys.exit(run())
  File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/__main__.py", line 111, in run
    run_build(pyi_config, spec_file, **vars(args))
  File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/__main__.py", line 63, in run_build
    PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
  File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 844, in main
    build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
  File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 791, in build
    exec(code, spec_namespace)
  File "/home/matthaeus/cybathlon/planvec/qt_video_gui_example.spec", line 17, in <module>
    noarchive=False)
  File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 243, in __init__
    self.__postinit__()
  File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/datastruct.py", line 158, in __postinit__
    self.assemble()
  File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 575, in assemble
    self._check_python_library(self.binaries)
  File "/home/matthaeus/.local/share/virtualenvs/planvec-R86NQhbu/lib/python3.6/site-packages/PyInstaller/building/build_main.py", line 681, in _check_python_library
    raise IOError(msg)
OSError: Python library not found: libpython3.6mu.so.1.0, libpython3.6m.so, libpython3.6m.so.1.0, libpython3.6.so.1.0
This would mean your Python installation doesn't come with proper library files.
This usually happens by missing development package, or unsuitable build parameters of Python installation.

* On Debian/Ubuntu, you would need to install Python development packages
  * apt-get install python3-dev
  * apt-get install python-dev
* If you're building Python by yourself, please rebuild your Python with `--enable-shared` (or, `--enable-framework` on Darwin)

我尝试了推荐的 python3-dev 和 python-dev 安装,但没有成功。 现在,我希望有人能告诉我这是怎么回事!

干杯, 马特


您需要在启用 CPython 共享库的情况下进行构建。

env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 3.6.9
eval "$(pyenv init -)"

参考:https://github.com/pyenv/pyenv/wiki https://github.com/pyenv/pyenv/wiki

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何将 pyinstaller 与 pipeline/pyenv 一起使用 的相关文章

随机推荐

  • 在C#中获取主目录的路径?

    好的 我已经查过了Environment SpecialFolder 但里面没有任何东西 我想在C 中获取当前用户的主目录 例如 c documents and settings user在XP下 c users user在 Vista 下
  • 如何找到给定数组中总和为“N”的所有匹配数字

    我的目标是找到所有可能的组合 总和达到给定的总数 例如 如果数组是 2 59 3 43 5 9 8 62 10 4 如果总数为 12 则可能的组合为 2 10 3 9 8 4 5 3 4 这是我编写的第一组代码 想知道对此可以进行的最佳改进
  • 跨源请求被阻止:同源策略不允许读取 http://........ 的远程资源

    我正在尝试使用 ajax 主要通过 javascript 从 Web 应用程序与企业应用程序进行通信 我尝试了很多方法来解决这个问题但没有成功 我在那里看到了几个在线 httppost 工具 我可以看到响应文本 但我这边并没有发生这种情况
  • 如何在 iframe 中正确显示 SSRS 站点

    I have been working on a project where I need to load a ssrs site within an iframe The iframe is acutally using the tele
  • android webview 中的 onShowFileChooser() 只能运行一次

    我需要从设备中选取图像并将其上传到服务器 第一次 当我选择图像时 onShowFileChooser 被调用并且一切正常 但是 当我尝试再次单击上传时 onShowFileChooser 永远不会被调用 但它适用于非棒棒糖设备 每当我单击上
  • 无法从 Google Places API 获取特殊营业时间

    特别营业时间在以下位置进行营销 记录谷歌我的商家 see https support google com business answer 6303076 https support google com business answer 6
  • Java时间解析“Jun 26th 2021, 04:30:15 pm NY”

    我有一个看起来像这样的字符串 String str Jun 26th 2021 04 30 15 pm NY 我想将其转换为ZonedDateTime 为此我使用DateTimeFormatterBuilder DateTimeFormat
  • 显式非单参数构造函数

    谁能解释为什么非单参数构造函数标记为显式编译 据我了解 这在这里绝对是无用的关键字 那么为什么它编译时没有错误呢 class X public explicit X int a int b 在 C 03 中 在这种特殊情况下 标记两个参数构
  • wxWidgets:如何捕捉wxListCtrl上的左键单击?

    我想将复选框添加到 wxListCtrl 这工作正常 只是当鼠标单击项目时似乎没有 EVT LIST ITEM CLICK 或 EVT LIST ITEM LEFT CLICK 事件来捕获 以便可以切换图像 有右键单击和中键单击的事件 但没
  • PHP CURL - 如何判断请求的整个文件是否未完全下载

    我使用 CURL 和代理来获取一些 xml 文件 有时当我尝试加载 使用 xml simplexml load string 时 只有部分 XML 文档会通过并失败 我想像 if curl errno ch error curl error
  • jQuery - 即使单击列表也会触发,但不会触发嵌入其中的复选框

    我正在制作一个简单的网络应用程序 在一部分中 我动态创建了一个列表 然后我有一个事件 当单击列表中的任何元素时会触发 document on click list not checkbox function console log list
  • 递归块过早释放

    我写了一个递归块如下these http ddeville me 2011 10 recursive blocks objc 指导方针 NSMutableArray groups NSMutableArray arrayWithArray
  • 从 Dns.GetHostEntry() 获取 IPv4 地址

    我这里有一些代码在 IPv4 机器上运行得很好 但在我们的构建服务器 IPv6 上却失败了 简而言之 IPHostEntry ipHostEntry Dns GetHostEntry string Empty GetHostEntry 的文
  • C++ 返回字符串不断出现垃圾

    为什么这里的返回字符串上有各种垃圾 string getChunk ifstream in char buffer 5 for int x 0 x lt 5 x buffer x in get cout lt lt x lt lt lt l
  • 未找到符号:__PyCodecInfo_GetIncrementalDecoder

    自从从 Homebrew Python 2 7 11 从 2 7 10 开始 更新后 我突然无法从 PyCharm IDE 控制台在 PyPi 上测试注册我的包 运行 作为 外部工具 python B setup py register r
  • 显示 Pandas 数据框的所有行和列[重复]

    这个问题在这里已经有答案了 我正在 Visual Studio 代码中使用 python 3 和 pandas 包 但 print 函数无法正确显示 例如 当我使用 df head 时 它看起来不错 但是 如果我使用 print 语句 我将
  • 在哪里可以找到被新功能弃用的 Android 功能列表?

    Android 开发者网站中是否有某些内容显示了 API 中的某些附加功能已弃用的内容 例如 一个人如何知道 Fragment 不赞成使用什么内容 Update 新的发行说明可以在此处的新 URL 上以更易于阅读的格式获取 https de
  • 从字符串中删除非 utf8 字符

    我在从字符串中删除非 utf8 字符时遇到问题 这些字符无法正确显示 字符是这样的 0x97 0x61 0x6C 0x6F 十六进制表示 去除它们的最佳方法是什么 正则表达式还是其他什么 如果您申请utf8 encode 对于已经是 UTF
  • 带有计算属性名称的 Typescript setState

    我正在使用 Typescript 2 1 我有一个带有 2 个数字集合的状态的 React 组件 我不想重复 addItem 和 removeItem 方法并希望它们是通用的 这是代码 type Collection challenges
  • 如何将 pyinstaller 与 pipeline/pyenv 一起使用

    我正在尝试从我的 python 脚本中发送一个可执行文件 该脚本位于使用 pipelinev 的虚拟环境中 它再次依赖 pyenv 进行 python 版本控制 为此 我想要使用 pyinstaller 我做了什么 pipenv insta