背景:我从未收到此错误,因为我已经在这个Python桌面程序上工作了六个多月,现在没有编译问题。
我写了一个新的python应用程序的更新beta版本,然后我使用cx_freeze编译代码。我使用了命令/
。但是,当我打开构建时收到此错误:
open System.Drawing
open System.Text.RegularExpressions
open System.IO
/// Changes timestamp string 'yyyy:dd:mm hh:mm:ss' to 'yyyy-mm-dd_hh.mm.ss'.
let changeTimeStampString (dt:string) =
let t = dt.Split(':', ' ')
// [yyyy; mm; dd; hh; mm; ss]
t.[0] + "-" + t.[1] + "-" + t.[2] + "_" + t.[3] + "." + t.[4] + "." + t.[5]
let rec getOrigDateTimeProp (propertyItems:Imaging.PropertyItem list) =
match propertyItems with
| x::xs -> match x.Id.ToString("x") with
| "9003" -> System.Text.Encoding.ASCII.GetString x.Value
| _-> getOrigDateTimeProp xs
| [] -> ""
let getOriginalDateTime (path:string) =
let img = new Bitmap(path)
let propItems = img.PropertyItems
getOrigDateTimeProp (propItems |> Array.toList)
let renameFile (path:string) =
let newName = (getOriginalDateTime path |> changeTimeStampString) + Path.GetExtension(path)
printfn "%s -> %s" <| path <| newName
File.Move(path, newName)
let rec renameFiles (paths:string list) =
match paths with
| x::xs -> match x with
| a when Regex.Match(a,@".+\.[jpg|JPG]").Success ->
renameFile x
renameFiles xs
| a when Regex.Match(a,@".+\.[mp4|MP4]").Success ->
printfn "this is an mp4"
renameFiles xs
| _ -> renameFiles xs
| [] -> ignore
[<EntryPoint>]
let main args=
renameFiles (args |> Array.toList)
0
我不知道如何修复此问题,因为我多次尝试安装tk要求。
这是我的python3 setup.py bdist_mac
:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cx_Freeze/initscripts/__startup__.py", line 14, in run
module.run()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/cx_Freeze/initscripts/Console.py", line 26, in run
exec(code, m.__dict__)
File "TachySloth.py", line 977, in <module>
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tkinter/__init__.py", line 2017, in __init__
self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)
_tkinter.TclError: Can't find a usable tk.tcl in the following directories:
/Users/julianrachman/Documents/code/suprbotcho/versions/beta/build/TachySloth-beta.app/Contents/MacOS/tk /Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tk8.5 /Library/Frameworks/Tcl.framework/Versions/8.5/Resources/Scripts/tk8.5/Resources/Scripts /Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tk8.5 /Library/Frameworks/Tcl.framework/Versions/8.5/Resources/tk8.5/Resources/Scripts /Users/julianrachman/Documents/code/suprbotcho/versions/beta/build/TachySloth-beta.app/Contents/lib/tk8.5 /Users/julianrachman/Documents/code/suprbotcho/versions/beta/build/TachySloth-beta.app/Contents/lib/tk8.5/Resources/Scripts ~/Library/Tcl/tk8.5 ~/Library/Tcl/tk8.5/Resources/Scripts /Library/Tcl/tk8.5 /Library/Tcl/tk8.5/Resources/Scripts /System/Library/Tcl/tk8.5 /System/Library/Tcl/tk8.5/Resources/Scripts ~/Library/Frameworks/tk8.5 ~/Library/Frameworks/tk8.5/Resources/Scripts /Library/Frameworks/tk8.5 /Library/Frameworks/tk8.5/Resources/Scripts /System/Library/Frameworks/tk8.5 /System/Library/Frameworks/tk8.5/Resources/Scripts /Library/Tcl/teapot/package/macosx10.5-i386-x86_64/lib/tk8.5 /Library/Tcl/teapot/package/macosx10.5-i386-x86_64/lib/tk8.5/Resources/Scripts /Library/Tcl/teapot/package/tcl/lib/tk8.5 /Library/Tcl/teapot/package/tcl/lib/tk8.5/Resources/Scripts /Users/julianrachman/Documents/code/suprbotcho/versions/beta/build/TachySloth-beta.app/lib/tk8.5 /Users/julianrachman/Documents/code/suprbotcho/versions/beta/build/TachySloth-beta.app/Contents/library
This probably means that tk wasn't installed properly.
logout
[Process completed]