小编rub*_*ing的帖子

[Python][cx-freeze] 导入错误:无法导入名称 'ExcelFormulaParser'

嗨,我在一段 python 代码上运行 cx-freeze 时遇到问题。当我单击 cx-freeze 生成的可执行文件时,它总是抛出错误消息。任何人都可以帮忙吗?- 使用 Python 3.6.1。

我还在另一段 python 代码上运行了 cx-freeze,它运行良好。

错误信息如下:

Last login: Thu Aug 31 14:45:12 on ttys002
EMacBook-Pro:~ E$ /Users/E/PycharmProjects/ImageRename/dist/exportImageName_1 ; exit;
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 "exportImageName_1.py", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/xlwt/__init__.py", line 4, in <module>
    from .Worksheet import Worksheet
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/xlwt/Worksheet.py", line 38, in <module>
    from .Row import Row
  File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/xlwt/Row.py", line 8, in …
Run Code Online (Sandbox Code Playgroud)

python cx-freeze python-3.x

2
推荐指数
1
解决办法
1208
查看次数

当使用"find_all_by"时,为什么要使用:order =>:title而不是:order => title

在视图haml文件中我有一个链接,当你点击时,你得到按标题或发布日期排序的所有电影.控制器中的代码是:

def index
    sort = params[:sort] || session[:sort]
    case sort
    when 'title'
      ordering,@title_header = {:order => :title}, 'hilite'
    when 'release_date'
      ordering,@date_header = {:order => :release_date}, 'hilite'
    end
   # some more codes here
@movies = Movie.find_all_by_rating(@selected_ratings.keys, ordering)
end
Run Code Online (Sandbox Code Playgroud)

如果我改变

ordering,@title_header = {:order => :title}, 'hilite'
至

 ordering,@title_header = {:order => title}, 'hilite'
Run Code Online (Sandbox Code Playgroud)

它给出了一个错误:

undefined local variable or method `title' for #<MoviesController:0xb29a853c>
Run Code Online (Sandbox Code Playgroud)

ruby ruby-on-rails

1
推荐指数
1
解决办法
288
查看次数

标签 统计

cx-freeze ×1

python ×1

python-3.x ×1

ruby ×1

ruby-on-rails ×1