Cx_freeze ImportError没有名为scipy的模块(Cx_freeze ImportError no module named scipy)
美好的一天,
我在使用cx_Freeze处理转换为.exe的代码时遇到了麻烦。
当我运行cx_Freeze时,我得到下面的ImportError,那里没有没有名为scipy的模块
running install running build running build_exe Traceback (most recent call last): File "setup.py", line 25, in <module> executables = executables File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 362, in setup distutils.core.setup(**attrs) File "C:\Python34\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Python34\lib\distutils\command\install.py", line 539, in run self.run_command('build') File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Python34\lib\distutils\command\build.py", line 126, in run self.run_command(cmd_name) File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 232, in run freezer.Freeze() File "C:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 619, in Freeze self.finder = self._GetModuleFinder() File "C:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 378, in _GetModuleFinder finder.IncludePackage(name) File "C:\Python34\lib\site-packages\cx_Freeze\finder.py", line 686, in IncludePackage module = self._ImportModule(name, deferredImports) File "C:\Python34\lib\site-packages\cx_Freeze\finder.py", line 386, in _ImportModule raise ImportError("No module named %r" % name) ImportError: No module named 'scipy'
我可以确认我的系统上安装了Scipy 0.16,当我将其导入到其他Python代码中时,它工作正常。 我目前在Windows上运行python 3.4。 以下是我的cx_Freeze的setup.py文件。
import cx_Freeze import sys import matplotlib base = None if sys.platform == 'win32': base = 'Win32GUI' executables = [cx_Freeze.Executable('fractureGUI.py', base=base, icon='star_square.ico')] packages = ['tkinter','matplotlib','scipy'] include_files = ['star_square.ico', 'C:\\Python34\\Lib\\site-packages\\scipy'] cx_Freeze.setup( name = 'FracturePositionMonteCarlo', options = {'build_exe': {'packages':packages, 'include_files':include_files}}, version = '0.01', description = 'Fracture Depth Monte Carlo', executables = executables )
以下是我的主脚本fractureGUI.py的导入部分。
import scipy from random import random import matplotlib import matplotlib.pyplot as plt import matplotlib.mlab as mlab matplotlib.use('TkAgg') from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib import style style.use('ggplot') import tkinter as tk from tkinter import ttk, filedialog import sys import json
如果任何人有任何想法,为什么cx_Freeze无法找到scipy请让我知道。 我试图在include_files下将文件路径添加到scipy中,但它没有任何区别。
亲切的问候,
Jonnyishman
Good day all,
I am having trouble using cx_Freeze on a code I am working on converting to a .exe.
When I run cx_Freeze I get the following ImportError that there no no module named scipy
running install running build running build_exe Traceback (most recent call last): File "setup.py", line 25, in <module> executables = executables File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 362, in setup distutils.core.setup(**attrs) File "C:\Python34\lib\distutils\core.py", line 148, in setup dist.run_commands() File "C:\Python34\lib\distutils\dist.py", line 955, in run_commands self.run_command(cmd) File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Python34\lib\distutils\command\install.py", line 539, in run self.run_command('build') File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Python34\lib\distutils\command\build.py", line 126, in run self.run_command(cmd_name) File "C:\Python34\lib\distutils\cmd.py", line 313, in run_command self.distribution.run_command(command) File "C:\Python34\lib\distutils\dist.py", line 974, in run_command cmd_obj.run() File "C:\Python34\lib\site-packages\cx_Freeze\dist.py", line 232, in run freezer.Freeze() File "C:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 619, in Freeze self.finder = self._GetModuleFinder() File "C:\Python34\lib\site-packages\cx_Freeze\freezer.py", line 378, in _GetModuleFinder finder.IncludePackage(name) File "C:\Python34\lib\site-packages\cx_Freeze\finder.py", line 686, in IncludePackage module = self._ImportModule(name, deferredImports) File "C:\Python34\lib\site-packages\cx_Freeze\finder.py", line 386, in _ImportModule raise ImportError("No module named %r" % name) ImportError: No module named 'scipy'
I can confirm that I have Scipy 0.16 installed on my system which works when I import it into other python code. I am currently running python 3.4 on Windows. The following is my setup.py file for cx_Freeze.
import cx_Freeze import sys import matplotlib base = None if sys.platform == 'win32': base = 'Win32GUI' executables = [cx_Freeze.Executable('fractureGUI.py', base=base, icon='star_square.ico')] packages = ['tkinter','matplotlib','scipy'] include_files = ['star_square.ico', 'C:\\Python34\\Lib\\site-packages\\scipy'] cx_Freeze.setup( name = 'FracturePositionMonteCarlo', options = {'build_exe': {'packages':packages, 'include_files':include_files}}, version = '0.01', description = 'Fracture Depth Monte Carlo', executables = executables )
The following is the import section of my main script, fractureGUI.py.
import scipy from random import random import matplotlib import matplotlib.pyplot as plt import matplotlib.mlab as mlab matplotlib.use('TkAgg') from matplotlib.backends.backend_tkagg import FigureCanvasTkAgg from matplotlib import style style.use('ggplot') import tkinter as tk from tkinter import ttk, filedialog import sys import json
If anybody has any ideas why cx_Freeze is unable to find scipy please do let me know. I tried to add the filepath to scipy under include_files but it made no difference.
Kind regards,
Jonnyishman
原文:https://stackoverflow.com/questions/32432887
最满意答案
你应该改变
+s
.*
另外,没有必要为
i
$newTerm = preg_replace('/\/(.*)\//', '', $searchTerm);
测试在这里: http : //regexpfiddle.com/
You should change the
+s
with.*
Also, no need for the
i
$newTerm = preg_replace('/\/(.*)\//', '', $searchTerm);
Tested here: http://regexpfiddle.com/
相关问答
更多-
TCP/IP模型是一个________。[2023-10-02]
a -
下列中不属于面向对象的编程语言的是?[2022-05-30]
a -
正则表达式问题(新手)(Regex Problem (newbie))[2022-07-10]
(http://[\w.-]+/.+?\.html) - 可能仅适用于您的情况。 或者可能更快 (http://[\w.-]+/[^.]+\.html) (http://[\w.-]+/.+?\.html) - may be will work for your case only. or may be faster one (http://[\w.-]+/[^.]+\.html) -
Postgres中的正则表达式 - 没有做我想做的事(新手问题)(Regex in Postgres - not doing what I'm trying to do (newbie question))[2024-04-05]
加倍你的反斜杠。 \ => \\ Postgres认为你正在对弦本身进行逃避。 在较新的PostgreSQL版本中,默认情况下启用standard_conforming_strings ,不再需要加倍反斜杠,除非您使用的是“ E'string'或已明确将standard_conforming_strings设置为off 。 Double your backslashes. \ => \\ Postgres thinks you're doing escapes on the string itself. I ... -
import re text = "
Date: 06/12/2010
" m = re.search("(Date:.*?)", text) print m.group(1) 产量 Date: 06/12/2010 import re text = "
Date: 06/12/2010
" m = re.search("(Date:.*? ... -
正则表达式援助给新手(Regex assistance to a newbie)[2023-10-07]
你应该改变+s .* 另外,没有必要为i $newTerm = preg_replace('/\/(.*)\//', '', $searchTerm); 测试在这里: http : //regexpfiddle.com/ You should change the +s with .* Also, no need for the i $newTerm = preg_replace('/\/(.*)\//', '', $searchTerm); Tested here: http://regexpfidd ... -
新手php正则表达式问题(newbie php regex issue)[2023-08-17]
它没有找到两者的原因是因为你在正则表达式的末尾有一个$ ,这意味着它只会匹配字符串末尾的那个模式。 尝试将$pattern更改$pattern /([0-9A-F]{6})-([0-9A-F]{6})/i ,这应该匹配两者。 The reason it isn't finding both is because you have a $ at the end of your regex which means it will only match that pattern at the end of the ... -
以下正则表达式将从行中提取逗号分隔的数字,然后我们可以应用split(',')以提取数字: import re line = "text1 769,230,123" mat = re.match(r'.*? ([\d+,]+).*', line) nums = mat.group(1).split(',') for num in nums: print num OUTPUT 769 230 123 The following regex will extract the comma separ ...
-
正则表达式施工协助(Regex construction assistance)[2021-08-19]
(?<=produktlista_)(\d{1,}(?:_v)\d{1,}|\d{4,}) 这将为您提供productlista的价值 编辑anubhavas正则表达式 \d{1,}(?:_v)?\d{1,}(?=.*?_web\.xlsx?$) 这里演示: http : //regex101.com/r/pW6mV8 I managed to solve this myself. Thanks for your efforts though, I really appreciated your hel ... -
Mongodb正则表达式的帮助(Mongodb regex assistance)[2023-03-02]
您不能使用update方法,因为除非您将upsert设置为True否则您的集合为空,但这仍然没有任何意义。 您需要使用insert_many方法。 input_data = {'Period': '12-2015', 'data': [{'EndDate': '10-12-2015', 'Pid': '566bb17761be0b1e0059c09d', 'Registration': 'TN 64 KS 7777', 'StartDate ...