cx_Freeze - 需要 appdirs 包
cx_Freeze - The appdirs package is required
我正在尝试将 .py 脚本转换为 .exe
cx_Freeze编译成功。但是,当我 运行 exe 文件时,它会抛出此错误:
ImportError: The 'appdirs' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution
这是我的setup.py
from cx_Freeze import setup, Executable
setup(
name = "dbx_sharelink" ,
version = "0.1" ,
description = " " ,
executables = [Executable("dbx_sharelink.py")] ,
)
源代码Python脚本
import sys
import dropbox
import pandas as pd
import sys
import os
dbx = dropbox.Dropbox('xxxxxxxxxxxxxxxxx')
def getSharedLink(full_path):
try:
link = dbx.sharing_create_shared_link(full_path).url
except dropbox.exceptions.ApiError as err:
print('*** API error', err)
return None
return link
print(sys.argv[1])
link = getSharedLink("/A_DATA/data")
df = pd.DataFrame([{'link':link}])
df.to_clipboard(index=False,header=False)
os.system("pause")
如何解决这个错误?
尝试升级到 setuptools 34.4.1,这对我有用
我遇到了同样的问题..
将 options 参数添加到 setup.py 文件,如下所示:
setup (name="MyAPP",
version="0.1",
description = "My GUI application!",
options = {'build_exe': {'packages':packages}},
.
.
.)
在包下放置(包应该在设置之前):
packages = ['pkg_resources._vendor']
(如有类似问题可以添加更多包..)
您可以在此处阅读有关选项的更多信息:http://cx-freeze.readthedocs.io/en/latest/distutils.html#build-exe
这解决了我的问题!
我遇到了同样的问题。
只需将软件包添加到选项
additional_mods = ['appdirs', 'packaging.version']
additional_packages = ['scipy', 'numpy', 'appdirs', 'packaging']
options = {
'build_exe': {
'packages': additional_packages,
'includes': additional_mods,
}
我正在尝试将 .py 脚本转换为 .exe
cx_Freeze编译成功。但是,当我 运行 exe 文件时,它会抛出此错误:
ImportError: The 'appdirs' package is required; normally this is bundled with this package so if you get this warning, consult the packager of your distribution
这是我的setup.py
from cx_Freeze import setup, Executable
setup(
name = "dbx_sharelink" ,
version = "0.1" ,
description = " " ,
executables = [Executable("dbx_sharelink.py")] ,
)
源代码Python脚本
import sys
import dropbox
import pandas as pd
import sys
import os
dbx = dropbox.Dropbox('xxxxxxxxxxxxxxxxx')
def getSharedLink(full_path):
try:
link = dbx.sharing_create_shared_link(full_path).url
except dropbox.exceptions.ApiError as err:
print('*** API error', err)
return None
return link
print(sys.argv[1])
link = getSharedLink("/A_DATA/data")
df = pd.DataFrame([{'link':link}])
df.to_clipboard(index=False,header=False)
os.system("pause")
如何解决这个错误?
尝试升级到 setuptools 34.4.1,这对我有用
我遇到了同样的问题.. 将 options 参数添加到 setup.py 文件,如下所示:
setup (name="MyAPP",
version="0.1",
description = "My GUI application!",
options = {'build_exe': {'packages':packages}},
.
.
.)
在包下放置(包应该在设置之前):
packages = ['pkg_resources._vendor']
(如有类似问题可以添加更多包..)
您可以在此处阅读有关选项的更多信息:http://cx-freeze.readthedocs.io/en/latest/distutils.html#build-exe
这解决了我的问题!
我遇到了同样的问题。 只需将软件包添加到选项
additional_mods = ['appdirs', 'packaging.version']
additional_packages = ['scipy', 'numpy', 'appdirs', 'packaging']
options = {
'build_exe': {
'packages': additional_packages,
'includes': additional_mods,
}