gpt4 book ai didi

Python line_profiler 安装

转载 作者:行者123 更新时间:2023-12-03 18:31:07 28 4
gpt4 key购买 nike

嗨,我是 Python 新手程序员。我想要逐行分析,因此尝试安装 line_profiler 包。但它不起作用。这是我所做的:

顺便说一下,我使用的是 64 位 Windows 8.1,并且正在使用 Enthought Canopy。

我从这里得到了 Windows 安装包:https://pypi.python.org/pypi/line_profiler并安装它。

它在 line_profiler 站点上说 a) 我不需要构建它或需要 Cython,b) 我应该这样做:

For IPython 0.11+, you can install it by editing the IPython configuration file ~/.ipython/profile_default/ipython_config.py to add the 'line_profiler' item to the extensions list:

c.TerminalIPythonApp.extensions = [ 'line_profiler', ]



我重新启动了 Canopy,没有运气。应该有一个魔法命令 %lprun。它不在那里。

我尝试了 %load_ext line_profiler 但收到了这条消息:

C:\Users\OEM\AppData\Local\Enthought\Canopy\User\lib\site-packages\line_profiler.py in () 10 import sys 11 ---> 12 from _line_profiler import LineProfiler as CLineProfiler 13 14

ImportError: DLL load failed: %1 is not a valid Win32 application.



其他事情:我为此寻找了 setup.py,但找不到似乎安装在 C:\Users\OEM\AppData\Local\Enthought\Canopy\User\Lib\site-packages 中的 line_profiler文件夹。

因此,请感谢任何帮助。

最佳答案

我使用的是 Windows 10,64 位

  • 你需要去非官方的 python 二进制文件 https://www.lfd.uci.edu/~gohlke/pythonlibs/
  • 然后按“Control+F”并输入“line_profiler”,然后选择它
    Searching package
  • 我使用 Python 3.7,Windows 10 64 位。然后选择最后一个Download your wheel file
  • 打开命令提示符(Windows+R 并输入 cmd)
  • 将方向更改为我的下载,我在其中下载我的文件“cd 下载”
  • 比输入这个命令
    C:/Users/YOUR_USER_NAME/AppData/Local/Programs/Python/Python37/Scripts/pip install "line_profiler-2.1.2-cp37-cp37m-win_amd64.whl"

  • Output in cmd

    ( Original source )

    关于Python line_profiler 安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21154643/

    28 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com