在python3.4中导入时出现PyXNAT错误

时间:2015-04-30 21:05:54

标签: python python-3.x

我在python3.4上安装了pyxnat包。我正确安装了所需的依赖项,如httplib2包和lxml。但仍然当我导入pyxnat我得到以下错误。

bash-3.2$ python3.4
Python 3.4.2 (v3.4.2:ab2c023a9432, Oct  5 2014, 20:42:22) 
[GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pyxnat import Interface
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/__init__.py", line 13, in <module>
    from .core import Interface
  File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/__init__.py", line 4, in <module>
    from .interfaces import Interface
  File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/interfaces.py", line 19, in <module>
    from .select import Select
  File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/select.py", line 4, in <module>
    from .search import Search
  File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/search.py", line 15, in <module>
    from .errors import is_xnat_error, catch_error
  File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/errors.py", line 31
    except Exception, e:
                    ^
SyntaxError: invalid syntax

有任何纠正此事的建议吗?

谢谢!

编辑: 在python 2.7中我得到以下错误

>>> myXNAT = Interface('https://hd-hni-xnat.cac.berkley.edu:8443/xnat')
User: sdb356
Password: 
(<type 'exceptions.IOError'>, 'interfaces.py', '')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/interfaces.py", line 228, in __init__
    self._get_entry_point()
  File "/Users/sdb99/usr/lib/python2.7/site-packages/pyxnat/core/interfaces.py", line 271, in _get_entry_point
    raise e
IOError: [Errno 13] Permission denied

我尝试查看interfaces.py以了解错误但不是..

1 个答案:

答案 0 :(得分:0)

您已经为 python2 安装了pyxnat并尝试在 python3 解释器中导入它,您还设法将您的python 2路径添加到你的python 3路径。