由于项目的需要,在win7下搭建pycharm + pyqt5 + python开发环境,搭建方法和过程可参考这位仁兄:
http://blog.csdn.net/justheretobe/article/details/50492094
搭建完毕后遇到2个问题:
一、搭建完毕后debug时报如下错误:
ImportError: numpy.core.multiarray failed to import
Traceback (most recent call last):
File "D:\JetBrains\PyCharm 5.0.6\helpers\pydev\pydevd.py", line 2411, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\JetBrains\PyCharm 5.0.6\helpers\pydev\pydevd.py", line 1802, in run
launch(file, globals, locals) # execute the script
File "D:\JetBrains\PyCharm 5.0.6\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "E:/MyPython/app_src/community_bank.py", line 10, in <module>
from main_win import MainWin
File "E:/MyPython/app_src\main_win.py", line 5, in <module>
import cv2, numpy, time, os
ImportError: numpy.core.multiarray failed to import
Process finished with exit code 1
折腾好久才找到解决办法:
1.启动命令行进入Python安装目录下的Scripts目录下
2.执行命令:
pip install -U numpy 注意-U一定是大写的
如这条执行失败看看是否有类似如下提示:
You are using pip version 7.1.2, however version 9.0.1 is available.
You should consider upgrading via the 'python -m pip install --upgrade pip' comm
and.
那么就需要执行命令:
python -m pip install --upgrade pip
成功后再执行pip install -U numpy
二.debug时报如下错误:
Connected to pydev debugger (build 143.2371)
Traceback (most recent call last):
File "D:\JetBrains\PyCharm 5.0.6\helpers\pydev\pydevd.py", line 2411, in <module>
globals = debugger.run(setup['file'], None, None, is_module)
File "D:\JetBrains\PyCharm 5.0.6\helpers\pydev\pydevd.py", line 1802, in run
launch(file, globals, locals) # execute the script
File "D:\JetBrains\PyCharm 5.0.6\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "E:/MyPython/app_src/community_bank.py", line 10, in <module>
from main_win import MainWin
File "E:/MyPython/app_src\main_win.py", line 11, in <module>
from data_exporter import DataExporter
File "E:/MyPython/app_src\data_exporter.py", line 6, in <module>
from excel_helper import ExcelHelper
File "E:/MyPython/app_src\excel_helper.py", line 4, in <module>
import xlsxwriter
ImportError: No module named 'xlsxwriter'
Traceback (most recent call last):
Traceback (most recent call last):
解决办法:
执行如下命令:
pip install xlxwriter