我尝试通过下载来构建此应用程序http://sourceforge.net/projects/miramath/?source=dlp在此过程中已经下载了+500mb数据,但在某一时刻我不断失败...这是我安装许多依赖项后最终得到的输出:
sudo python main.py
Traceback (most recent call last):
File "main.py", line 28, in <module>
from mainwindow import *
File "/home/usama/Downloads/miramath/mainwindow.py", line 24, in <module>
import worksheet
File "/home/usama/Downloads/miramath/worksheet.py", line 37, in <module>
import polarplot
File "/home/usama/Downloads/miramath/polarplot.py", line 30, in <module>
from polarplotwidget import PolarPlotWidget
File "/home/usama/Downloads/miramath/polarplotwidget.py", line 29, in <module>
class PolarPlotWidget(Qwt.QwtPolarPlot):
AttributeError: 'module' object has no attribute 'QwtPolarPlot'
所以我通过下载了 PyQwthttp://sourceforge.net/projects/miramath/files/PyQwt-Polar/
按照手册我导航到配置文件夹并运行:
python configure.py -Q ../qwt-5.2
Command line options:
{'debug': False,
'disable_numarray': False,
'disable_numeric': False,
'disable_numpy': False,
'excluded_features': [],
'extra_cflags': [],
'extra_cxxflags': [],
'extra_defines': [],
'extra_include_dirs': [],
'extra_lflags': [],
'extra_lib_dirs': [],
'extra_libs': [],
'jobs': '',
'module_install_path': '',
'modules': [],
'qt': 4,
'qwt_sources': '../qwt-5.2',
'sip_include_dirs': [],
'subdirs': [],
'timelines': [],
'trace': ''}
Found SIP-4.13.3.
Found 'posix' operating system:
2.7.3 (default, Sep 26 2012, 21:53:58)
[GCC 4.7.2]
Do not get upset by error messages in the next 3 compiler checks:
Check if 'size_t' and 'unsigned int' are the same type:
YES
Check if 'size_t' and 'unsigned long' are the same type:
size_t_check.cpp:3:6: error: prototype for ‘void a::f(long unsigned int)’ does not match any in class ‘a’
size_t_check.cpp:2:24: error: candidate is: void a::f(size_t)
NO
Check if 'size_t' and 'unsigned long long' are the same type:
size_t_check.cpp:3:6: error: prototype for ‘void a::f(long long unsigned int)’ does not match any in class ‘a’
size_t_check.cpp:2:24: error: candidate is: void a::f(size_t)
NO
Failed to import numarray: PyQwt will be build without support for numarray.
Failed to find Numeric2: PyQwt will be build without support for Numeric.
Found NumPy-1.6.2.
g++ -c -pipe -O2 -Wall -W -D_REENTRANT -DQT_WEBKIT -DQT_NO_DEBUG -DQT_CORE_LIB -DQT_SHARED -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4 -I../qwt-5.2/src -I/usr/include/python2.7 -I/usr/lib/python2.7/dist-packages/numpy/core/include -I. -o qwt_version_info.o qwt_version_info.cpp
g++ -Wl,-O1 -o qwt_version_info qwt_version_info.o -L/usr/lib/i386-linux-gnu -lQtCore -lpthread
Found Qwt-5.2.1.
Extended command line options:
{'debug': False,
'disable_numarray': False,
'disable_numeric': False,
'disable_numpy': False,
'excluded_features': ['-x HAS_PYQT_031105',
'-x HAS_NUMARRAY',
'-x HAS_NUMERIC',
'-x HAS_QWT4'],
'extra_cflags': [],
'extra_cxxflags': [],
'extra_defines': ['HAS_NUMPY'],
'extra_include_dirs': ['/usr/include/python2.7',
'/usr/lib/python2.7/dist-packages/numpy/core/include'],
'extra_lflags': [],
'extra_lib_dirs': [],
'extra_libs': [],
'iqt': 'iqt5qt4',
'iqt_sipfile': '../sip/iqt5qt4/IQtModule.sip',
'jobs': '',
'module_install_path': '/usr/lib/python2.7/dist-packages/PyQt4/Qwt5',
'modules': ['iqt', 'Qwt5'],
'qt': 4,
'qwt': 'qwt5qt4',
'qwt_sipfile': '../sip/qwt5qt4/QwtModule.sip',
'qwt_sources': '../qwt-5.2',
'sip_include_dirs': [],
'subdirs': ['iqt5qt4', 'qwt5qt4'],
'timelines': ['-t Qwt_5_2_0'],
'trace': ''}
The following modules will be built: ['iqt', 'Qwt5'].
Setup the PyQwt package build.
sip invokation:
'/usr/bin/sip -b tmp-iqt5qt4/iqt5qt4.sbf -c tmp-iqt5qt4 ../sip/iqt5qt4/IQtModule.sip'
sh: 1: /usr/bin/sip: not found
SIP failed to generate the C++ code.
我该如何解决这个问题?
上述问题通过安装解决:python-qt4-dev libqwt-dev python-sip-dev python-dev
成功构建 PyQwt 后,我在运行 miramath 时遇到一个新错误
python main.py
running...
Traceback (most recent call last):
File "main.py", line 77, in <module>
main(sys.argv)
File "main.py", line 51, in main
main = MainWindow()
File "/home/usama/Downloads/miramath/mainwindow.py", line 55, in __init__
self.addTab()
File "/home/usama/Downloads/miramath/mainwindow.py", line 436, in addTab
w = worksheet.WorkSheet(self, self.runtimeStatusMessage, self.numEquationsStatusMessage, self.currentEquationStatusMessage)
File "/home/usama/Downloads/miramath/worksheet.py", line 94, in __init__
self.execution_thread = execthread.ExecThread(self)
File "/home/usama/Downloads/miramath/execthread.py", line 56, in __init__
exec symbolics_init_program in self.symbolics_global_namespace # execfile goes away in 3.0
File "<string>", line 91, in <module>
AttributeError: 'module' object has no attribute 'abs'
问题已解决@green7 的回答如下
答案1
- 打开文件
symbolics_init.py
。 - 转至第 行
91
。 sympy.abs
用。。。来代替sympy.Abs