安装Python包 - IronPython

6
我希望将PRAW包添加到VS中的IronPython解决方案中,但这证明是一件麻烦的事情。以下是我正在采取的步骤:
  • 右键单击IronPython环境,选择安装Python包。
  • 使用pip输入“Praw”
  • 我收到一个提示,告诉我需要安装pip。
然后我看到以下内容:
Installing 'pip' package manager.
Downloading distribute from https://go.microsoft.com/fwlink/?LinkID=306663
Installing from distribute-0.6.45
Before install bootstrap.
Scanning installed packages
Setuptools installation detected at c:\program files (x86)\ironpython 2.7\lib\site-packages\setuptools-0.6c11-py2.7.egg
Egg installation
Already patched.
running install
Traceback (most recent call last):
  File "setup.py", line 147, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\core.py", line 151, in setup
  File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\dist.py", line 952, in run_commands
  File "C:\Program Files (x86)\IronPython 2.7\Lib\distutils\dist.py", line 971, in run_command
  File "c:\users\mj\appdata\local\temp\ptvs-9jvsvw-pip_downloader\distribute-0.6.45\setuptools\command\install.py", line 63, in run
AttributeError: 'module' object has no attribute '_getframe'Traceback (most recent call last):
  File "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\Extensions\Microsoft\Python Tools for Visual Studio\2.0\pip_downloader.py", line 47, in <module>
  File "C:\Program Files (x86)\IronPython 2.7\Lib\subprocess.py", line 512, in check_call
subprocess.CalledProcessError: Command '['C:\\Program Files (x86)\\IronPython 2.7\\ipy64.exe', 'setup.py', 'install']' returned non-zero exit status 1
'pip' failed to install. Exit code: 1

安装失败的原因是:AttributeError: 'module' object has no attribute '_getframe'Traceback (most recent call last):

如何解决这个问题?是否有一种不同的方式安装pip和ironpython?是否有一种不使用pip就可以安装软件包/库的方法?我可以通过Pip for python 2.7很好地安装该软件包。


尝试使用easy_install。我不知道它是否能解决你的问题,但是通过谷歌搜索我找到了以下链接:http://blog.jdhardy.ca/2008/08/easyinstall-on-ironpython.html - Rohit
这对我也是一个问题,目前还没有找到解决方案! - Jeroen van Langen
1个回答

3
您需要在命令行选项中使用-X:FullFrames来运行IronPython。不过,我不确定如何在VS中设置它。
也许您可以手动运行它:
C:\path\to\ipy64.exe -X:FullFrames path\to\pip.py install whaterver_you_want

2
我仍然收到“对象没有属性'_getframe'”的错误信息。 - MickJuice
2
似乎只有在CPython环境下才能安装软件包。我查看了他们的代码,发现他们有自己的pip和distribute版本,但显然它仍无法与IronPython一起使用。也许你应该在他们的网站上创建一个问题。 - Viktor Kerkez
谢谢 Viktor。我决定现在使用普通的Python,不再费心使用IronPython。使用IP的主要原因是我想使用.Net dlls,因为我更熟悉它们,但经过一些思考,使用Python库将使我走出舒适区并让我学到更多。感谢你的帮助。 - MickJuice
1
PTVS没有自己的pip和distribute版本 - 它会下载并安装标准包。 - Pavel Minaev
1
@PavelMinaev pip_downloader.py 所有指向 pip 的链接都以 https://go.microsoft.com/... 开头,因此我认为它不是一个标准的软件包...但现在我看到它们只是转发链接...我的错误。 - Viktor Kerkez
1
就我所知,我已经尝试在IronPython 2.7.4上安装setuptools,即使使用-X:FullFrames也无法成功。看起来它仍然不受支持。 PTVS并不会阻止您尝试,因为未来的某个版本可能会添加缺失的部分。 - Pavel Minaev

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接