1

I've been using IronPython to use functions in a C# .dll class library. I have also been using another set of packages called Psychopy. However, IronPython does not recognize Pyschopy packages. I tried placing a .pth file that said the following in IronPython's site-packages folder: C:/Program Files (x86)/PsychoPy2/Lib/site-packages/PsychoPy-1.80.03-py2.7.egg

I then changed the sys.prefix, sys.exec_prefix variables in site.py to "C:/Program Files (x86)/IronPython 2.7". Then, I went to the command line and in the ironpython shell, I tried to import psychopy. I received the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in '<'module'>'
  File "C:\Program Files (x86)\PsychoPy2\Lib\site-packages\PsychoPy-1.80.03-py2.7.egg\psychopy\__init__.py", line 33, in '<'module'>'"
  File "C:\Program Files (x86)\PsychoPy2\Lib\site-packages\PsychoPy-1.80.03-py2.7.egg\psychopy\preferences\__init__.py", line 5, in '<'module'>'
  File "C:\Program Files (x86)\PsychoPy2\Lib\site-packages\PsychoPy-1.80.03-py2.7.egg\psychopy\preferences\preferences.py", line 186, in '<'module'>'
  File "C:\Program Files (x86)\PsychoPy2\Lib\site-packages\PsychoPy-1.80.03-py2.7.egg\psychopy\preferences\preferences.py", line 32, in __init__
  File "C:\Program Files (x86)\PsychoPy2\Lib\site-packages\PsychoPy-1.80.03-py2.7.egg\psychopy\preferences\preferences.py", line 95, in getPaths
  File "C:\Program Files (x86)\IronPython 2.7\Lib\os.py", line 423, in __getitem__
KeyError: HOME

I was wondering if anyone know how to install thrid party packages in Ironpython.

4

1 回答 1

1

我猜您可以通过将 HOME 添加为环境变量(系统属性>高级)并将其指向您的主文件夹来解决此问题。

我不确定为什么 IronPython 需要该步骤而不是常规 C python - 我猜 C Python 如果找不到它会创建它?

我也不知道 PsychoPy 还会出现什么问题。我从未使用过 IronPython

乔恩

于 2014-08-11T14:02:21.487 回答