- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试使用 PyInstaller 2.0 制作 Python 脚本的二进制版本。我正在使用一个基本的“hello world”tkinter 脚本,但导入了一些项目需要的依赖项来测试 Pyinstaller。我在运行 Yosemite 10.10.5 的 Mac 上。这是我的脚本:
#!/usr/bin/env python
from Tkinter import *
import Tix
import tkMessageBox
from sklearn import linear_model, decomposition, preprocessing
from sklearn.preprocessing import Imputer
from sklearn.cross_validation import cross_val_score, cross_val_predict
from sklearn.neighbors import KDTree
import numpy as np
import collections
import array
import math
import csv
from collections import OrderedDict
import matplotlib
matplotlib.use("TkAgg")
import matplotlib.pyplot as plt
import matplotlib.dates as dates
from matplotlib.mlab import PCA
from mpl_toolkits.mplot3d import Axes3D
from scipy.stats import mode
import heapq
import sqlite3
from sqlite3 import datetime
root = Tk()
w = Label(root, text="Hello, world!")
w.pack()
root.mainloop()
这运行完美。但是,当我使用
构建二进制文件时$pyinstaller -w -F app.py
然后我得到这个错误:
57665 ERROR: Can not find path ./libpython2.7.dylib (needed by //anaconda/bin/python)
Traceback (most recent call last):
File "//anaconda/bin/pyinstaller", line 11, in <module>
sys.exit(run())
File "//anaconda/lib/python2.7/site-packages/PyInstaller/__main__.py", line 90, in run
run_build(pyi_config, spec_file, **vars(args))
File "//anaconda/lib/python2.7/site-packages/PyInstaller/__main__.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "//anaconda/lib/python2.7/site-packages/PyInstaller/building/build_main.py", line 788, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "//anaconda/lib/python2.7/site-packages/PyInstaller/building/build_main.py", line 734, in build
exec(text, spec_namespace)
File "<string>", line 16, in <module>
File "//anaconda/lib/python2.7/site-packages/PyInstaller/building/build_main.py", line 212, in __init__
self.__postinit__()
File "//anaconda/lib/python2.7/site-packages/PyInstaller/building/datastruct.py", line 178, in __postinit__
self.assemble()
File "//anaconda/lib/python2.7/site-packages/PyInstaller/building/build_main.py", line 543, in assemble
self._check_python_library(self.binaries)
File "//anaconda/lib/python2.7/site-packages/PyInstaller/building/build_main.py", line 626, in _check_python_library
raise IOError(msg)
IOError: Python library not found: libpython2.7.dylib, Python, .Python
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)
有人知道我该如何解决这个问题吗?当我使用没有额外依赖项的基本 hello world 示例时,也会发生此错误。我在//anaconda/lib 中有 libpython2.7.dylib 文件,我尝试使用
将它链接到 usr/lib/$sudo ln -s /usr/local/lib/libpython2.7.dylib //anaconda/lib/libpython2.7.dylib
但是它并没有解决问题...
最佳答案
如果您像我一样通过 pyenv 使用 python,您可能需要重新安装并启用共享以访问 xcode 库,除非您之前已经这样做了。
sudo env PYTHON_CONFIGURE_OPTS="--enable-shared" pyenv install 2.7
PS:我在 Darwin 上,但 enable-shared
比 enable-framework
还有效
事实上,下面的错误消息告诉我们该怎么做
关于python - mac上的PyInstaller找不到libpython2.7,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38920076/
在 this question 的后续问题中,我的企业环境缺少 libpython2.6.so 共享对象,但有 libpython2.6.a 文件。有没有一种方法可以在 libpython2.6.a
构建 rPython 包时,我在 R 中遇到错误,特别是链接 libpython2.7 的部分: gcc -std=gnu99 -I/foo/bar/R-3.1.1/lib64/R/include -
我有一个同时嵌入了 python2 和 python3 解释器的程序。 libpython 共享库由提供对解释器的访问权限的相应命令dlopen()编辑,每个解释器维护自己的状态。 如果用户只使用纯
我没有让 vim 与 python 支持一起工作。我使用以下配置编译 vim 7.4.972: ./configure --enable-shared --with-features=huge --e
在较新的 Ubuntu/Debian 版本下,libpython2.7.so 位于 /usr/lib/i386-linux-gnu/libpython2.7.so 或 /usr/lib/x86_64-
我在 CentOS 5 上安装 Python 2.7。我构建并安装了 Python,如下所示 ./configure --enable-shared --prefix=/usr/local make
我在 macOS 上使用 Conda,在构建 Rust 包时遇到错误,它找不到 libpython3.7m.dylib 库。我怎样才能找到它? 经过一些研究,在 Linux 上,您通常可以从 Ubun
Following the instructions on the PyCall.jl readme ,在我的 julia 项目(在它自己的环境中)使用 PyCall 时,我想使用 pipelinen
我正在运行 arch,在我之前设置的一个项目中,我使用 virtualenv 设置了一个小 python 沙箱。此时,我的机器上的默认 python 版本是 3.2 它已经升级到 3.3,但是当我进入
我正在构建 vim 的 YouCompleteMe 插件,遵循这个 document .当我运行 make 时,出现以下错误。 Linking CXX shared library /home/sag
我在 iOS 应用程序中嵌入了 libPython.a,我正在使用 PyRun_SimpleFileEx 运行脚本: Py_SetPythonHome((char *)[resourcePat
是否有任何独立于平台的方法来获取 python 安装的 libpython 的路径,以用作 cmake 参数? sysconfig.get_config_var 提供了一些片段,但我没有一致的方法可以
我问了另一个问题,这个问题太复杂了,无法直接回答,所以我把它归结为这个基本问题...... 当我使用标准的 cython distutils 构建我的 aModule.so 时,它似乎没有链接到 li
我一直在研究 project使用 libpython2.7.so 将 Python 解释器作为 MEX 文件嵌入到 MATLAB 中,但是每当我尝试导入作为扩展模块实现的 Python 模块时都会遇到
我正在尝试在 arm 设备的嵌入式解释器中运行 python 代码;使用 marmalade studio 在 visual studio 2012 中构建。 我已经构建了我的存档静态链接库,li
我正在尝试在我的代码中记录热点,以便能够使用多线程对其进行优化。 我首先运行在容器外安装了 pyflame sudo apt-get install autoconf automake autotoo
我是一名优秀的程序员,十分优秀!