- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想使用 cx_freeze 卡住 python 应用程序,但我也想保留使用 pip 从源代码安装包的可能性。当我尝试在开发模式下安装软件包时(pip install -e .
),我收到如下错误。看来 cx_freeze 在后台使用 distutils
而不是 setuptools
。是否可以强制 cx_freeze 也使用 setuptools?
D:\Python\FPF4Creator>pip install -e .
You are using pip version 7.0.3, however version 7.1.2 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' command.
Obtaining file:///D:/Python/FPF4Creator
Requirement already satisfied (use --upgrade to upgrade): jinja2 in c:\winpython\python-2.7.6\lib\site-packages (from fpf4creator==0.0.2)
Requirement already satisfied (use --upgrade to upgrade): six in c:\winpython\python-2.7.6\lib\site-packages (from fpf4creator==0.0.2)
Requirement already satisfied (use --upgrade to upgrade): markupsafe in c:\winpython\python-2.7.6\lib\site-packages (from jinja2->fpf4creator==0.0.2)
Installing collected packages: fpf4creator
Running setup.py develop for fpf4creator
Complete output from command C:\WinPython\python-2.7.6\python.exe -c "import setuptools, tokenize; __file__='D:\\Python\\FPF4Creator\\setup.py'; e
xec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps:
running develop
Checking .pth file support in C:\Program Files (x86)\fpf4creator\Lib\site-packages\
error: can't create or remove files in install directory
The following error occurred while trying to add or remove files in the
installation directory:
[Error 5] Zugriff verweigert: 'C:\\Program Files (x86)\\fpf4creator'
The installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
C:\Program Files (x86)\fpf4creator\Lib\site-packages\
This directory does not currently exist. Please create it and try again, or
choose a different installation directory (using the -d or --install-dir
option).
----------------------------------------
Command "C:\WinPython\python-2.7.6\python.exe -c "import setuptools, tokenize; __file__='D:\\Python\\FPF4Creator\\setup.py'; exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" develop --no-deps" failed with error code 1 in D:\Python\FPF4Creator
setup.py
如下所示:
import os
from setuptools import find_packages
from cx_Freeze import setup, Executable
from fpf4creator import __version__
options = {
'build_exe': {
'include_files': 'fpf4creator/data',
}
}
executables = [
Executable('fpf4creator/gui.py', targetName='FPF4Creator.exe',
icon='fpf4creator/data/gui/icon.ico', base="Win32GUI")
]
fpf4_data = []
for root, dirnames, filenames in os.walk('fpf4creator/data'):
for fname in filenames:
fpf4_data.append(os.path.join(root, fname).replace('fpf4creator/', ''))
setup(
name='fpf4creator',
version=__version__,
author='Author',
author_email='mail@author.com',
packages=find_packages(),
package_data={
'fpf4creator': fpf4_data
},
install_requires=['jinja2', 'six'],
entry_points={
'gui_scripts': [
'fpf4Creator = fpf4creator.gui:main',
],
},
options=options,
executables=executables
)
最佳答案
(发布答案是为了重申@ThomasK 几年前作为评论给出的答案,因为它现在对我有帮助)
您应该为 cx-Freeze 创建一个附加安装文件。该文件的名称可以自由选择,但不应是 setup.py
。
不幸的是,您可能需要再次指定大多数设置参数。您还可以利用 sys.path
contains the main script's directory 的事实来修改一个从 setup.py
检索设置参数的解决方案。 .
================== setup.py ==================
from setuptools import setup, find_packages
setup_arguments = { 'name': 'myapp', 'version': '0.0.0' }
if __name__ == '__main__' :
setup( **setup_arguments )
================ setup_cx.py =================
from setup import setup_arguments
from cx_Freeze import setup
setup( **setup_arguments )
关于Python cx_freeze 和 setuptools,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34134163/
我正在尝试编译一个 python 程序,我使用的是 python 3.2。所以我下载了 cx_freeze 并安装了它。当我尝试在 cmd 中运行 setup.py 时,它说: "importerro
我正在尝试将我的 python 3.4 程序转换为 exe 以供分发。我尝试使用 cx_Freeze 来做到这一点。但是,当我使用此 setup.py 运行 python setup.py build
我在使用 cx_Freeze-5.0.1-cp36-cp36m-win32.whl 将 python 3.6 编译为 exe 时遇到问题,请帮助我。 我已经从http://www.lfd.uci.ed
比方说 numpy_example.py是: import numpy as np a = np.array([1, 2, 3]) print(a) 使用 Python 2.7.9,使用 cxFree
我正在使用 python 3.7 和 cx_Freeze 5.1.1 ,我试图将我的 python 脚本转换为可执行文件,但我遇到了丢失模块错误,我被难住了。 我尝试将模块放入包中并包含安装脚本,但没
我正在尝试为 Python 3.3 安装 cx_Freeze。但是,在编译源代码时出现此错误 gcc -pthread build/temp.linux-i686-3.3/source/bases/C
tss.py --> 该文件包含一个打开另一个 python 文件 (dark.py) 的子进程 import subprocess as sp def process(): programN
所以我的 python 脚本依赖于我创建的另一个模块。该模块读取文本文件。当我从源代码运行并且一切正常时,脚本、模块和它读取的文件通常位于同一目录中。 我用cx_freeze编译,当我运行它时,导入的
我有一个应用程序,可以在运行时将一些内容打印到控制台。但作为独立的可执行文件不会在控制台上打印任何内容? setup.py 脚本如下所示: import sys from cx_Freeze impo
我尝试将我的(正常工作的)python 3.6 tkinter gui 应用程序构建为 Windows 可执行文件。经过几个小时的尝试,出现了一个错误(有一些名称和 dll 问题),我让它运行了。但它
目前我正在使用 pyinstaller 来捆绑我的 python 应用程序。我同样迁移到 pyGObject(由于 pygtk 被折旧)。 现在 pyinstaller 不支持 pyGObject 并
我正在使用 cx_freeze 模块来创建安装程序和可执行文件。这似乎工作正常,但在运行可执行文件时,我收到以下错误和回溯。 D:\>"app.exe" Traceback (most recent
我可以使用 cx_freeze 来打包我的 python 工具,但是无法加载我需要的库。由于某种原因,输出的可执行文件/二进制名称不断包含在路径中。 我收到以下错误: OSError:/home/de
我正在尝试从 python 脚本(使用大量鸡蛋)构建可执行文件(适用于 32 位 Windows xp) 我考虑过 py2exe(0.6.9)、PyInstaller (1.4) 和 cx_Freez
您好,我尝试在我的 Linux 上安装 cx_Freeze,但我无法安装。我想安装它以将我的 python 应用程序 (.py) 转换为可执行应用程序。 我从这个网站下载资源:https://sour
我选择尝试使用 cx_freeze,它将我的简单 python 3.x 键盘记录器转换为 exe。我选择 cx_freeze 因为 py2exe 只是 python 2.x 我正在使用这个 setup
Adter 使用 cx-freeze python 3.6 创建一个 exe,在 Windows 中工作正常,但在 Linux 中它运行无限次而不停止,即使我只输入 print('hello word
我制作了一个程序,它使用 os.startfile() 启动另一个 python 程序。 我想把它作为两个 exe 文件,通过使用 subprocess.call() 启动第二个文件,在 1 个构建文
我目前正在尝试制作 cx_freeze在我必须使用的 Solaris 工作站上工作,以便从我拥有的 Python 脚本生成可执行文件。问题是,我不是这台机器的管理员,安装cx_freeze请求写入站点
我在将内容包含到我的 cx_Freeze 脚本中时遇到了这个问题,我试图做的是包含 easygui 和 sys,因为我在我的程序中使用它们。任何帮助将不胜感激! 代码如下: import sys fr
我是一名优秀的程序员,十分优秀!