我正在尝试在 python 中进行线路配置文件和内存配置文件。
我通过导入 line_profiler
从 line_profiler 导入 LineProfiler
当我运行我的代码时,我收到错误消息:
ModuleNotFoundError:没有名为“line_profiler”的模块
当我尝试使用 pip install 安装它时:
py -m pip install line_profiler
一切都很好,但最后它给出了红色的东西:
C:\Users\asmobari>py -m pip install line_profiler 收集
line_profiler 使用缓存https://files.pythonhosted.org/packages/14/fc/ecf4e238bb601ff829068e5a72cd1bd67b0ee0ae379db172eb6a0779c6b6/line_profiler-2.1.2.tar.gz https://files.pythonhosted.org/packages/14/fc/ecf4e238bb601ff829068e5a72cd1bd67b0ee0ae379db172eb6a0779c6b6/line_profiler-2.1.2.tar.gz已满足要求:IPython>=0.13 in
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 line_profiler)(7.0.1)已满足要求:
性状>=4.2 英寸
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler) (4.3.2) 已满足要求
满意:简单通用>0.8 英寸
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler)(0.8.1)已满足要求
满意:回拨
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler)(0.1.0)已满足要求
满意:装饰者在
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler)(4.3.0)已满足要求
满意:泡菜分享
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler)(0.7.5)已满足要求
满意:jedi>=0.10 英寸
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler)(0.13.1)已满足要求
满意: pygments 在
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler)(2.2.0)已满足要求
满意:色彩; sys_platform ==“win32”中
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler)(0.4.0)已满足要求
满意:prompt-toolkit=2.0.0中
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler)(2.0.6)已满足要求
满意:setuptools>=18.5 英寸
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 IPython>=0.13->line_profiler)(39.0.1)已满足要求
满意: ipython-genutils 中
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自特征>=4.2->IPython>=0.13->line_profiler)(0.2.0)
已满足的要求:六进
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自特征>=4.2->IPython>=0.13->line_profiler)(1.11.0)
已满足要求:parso>=0.3.0 in
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自 jedi>=0.10->IPython>=0.13->line_profiler) (0.3.1) 要求
已经满足了:wcwidth in
c:\users\asmobari\appdata\local\programs\python\python37\lib\site-packages
(来自提示工具包=2.0.0->IPython>=0.13->line_profiler)
(0.1.7) 安装收集的包:line-profiler 运行
setup.py install for line-profiler ...错误
命令 C:\Users\asmobari\AppData\Local\Programs\Python\Python37\python.exe -u 的完整输出
-c“导入setuptools,标记化;file='C:\Users\asmobari\AppData\Local\Temp\pip-install-2w13a4ux\line-profiler\setup.py';f=getattr(tokenize,
'打开',打开)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(编译(代码,file,'执行'))”安装
--record C:\Users\asmobari\AppData\Local\Temp\pip-record-h8dq1h7x\install-record.txt
--单一版本-外部管理--编译:
运行安装
运行构建
运行build_py
创建构建
创建 build\lib.win-amd64-3.7
复制 line_profiler.py -> build\lib.win-amd64-3.7
复制 kernprof.py -> build\lib.win-amd64-3.7
复制 line_profiler_py35.py -> build\lib.win-amd64-3.7
运行 build_ext
跳过 '_line_profiler.c' Cython 扩展(最新)
构建“_line_profiler”扩展
创建 build\temp.win-amd64-3.7
创建 build\temp.win-amd64-3.7\Release
C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\bin\HostX86\x64\cl.exe
/c /nologo /Ox /W3 /GL /DNDEBUG /MD
-IC:\Users\asmobari\AppData\Local\Programs\Python\Python37\include -IC:\Users\asmobari\AppData\Local\Programs\Python\Python37\include "-IC:\Program Files (x86)\Microsoft视觉的
Studio\2017\BuildTools\VC\Tools\MSVC\14.15.26726\include"
“-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\ucrt”
“-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\shared”
“-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\um”
“-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17134.0\winrt”
“-IC:\Program Files (x86)\Windows
套件\10\include\10.0.17134.0\cppwinrt" /Tc_line_profiler.c
/Fobuild\temp.win-amd64-3.7\Release_line_profiler.obj
_line_profiler.c
_line_profiler.c(7890):错误C2039:'exc_type':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7891):错误C2039:'exc_value':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7892):错误C2039:'exc_traceback':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7899):错误C2039:'exc_type':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7900):错误C2039:'exc_value':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7901):错误C2039:'exc_traceback':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7902):错误C2039:'exc_type':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7903):错误C2039:'exc_value':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7904):错误C2039:'exc_traceback':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7959):错误C2039:'exc_type':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7960):错误C2039:'exc_value':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7961):错误C2039:'exc_traceback':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7962):错误C2039:'exc_type':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7963):错误C2039:'exc_value':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
_line_profiler.c(7964):错误C2039:'exc_traceback':不是'_ts'的成员
c:\users\asmobari\appdata\local\programs\python\python37\include\pystate.h(209):
注意:请参阅“_ts”的声明
error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\BuildTools\\VC\\Tools\\MSVC\\14.15.26726\\bin\\HostX86\\x64\\cl.exe'
失败,退出状态为 2
---------------------------------------- Command "C:\Users\asmobari\AppData\Local\Programs\Python\Python37\python.exe
-u -c“导入安装工具,标记化;file='C:\Users\asmobari\AppData\Local\Temp\pip-install-2w13a4ux\line-profiler\setup.py';f=getattr(tokenize,
'打开',打开)(file);code=f.read().replace('\r\n',
'\n');f.close();exec(编译(代码,file,'执行'))”安装
--record C:\Users\asmobari\AppData\Local\Temp\pip-record-h8dq1h7x\install-record.txt
--single-version-externally-management --compile" 失败,错误代码为 1
C:\Users\asmobari\AppData\Local\Temp\pip-install-2w13a4ux\line-profiler\
我想知道是否有人可以帮我解决这个问题,或者是否有人知道除了 from line_profiler import Line_Profiler 和 import line_profiler to import line_profiler 之外的方法
您可以安装预构建的二进制文件here https://www.lfd.uci.edu/~gohlke/pythonlibs/#line_profiler
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)