当我尝试使用macports python时,PyCharm抛出错误

时间:2016-09-14 02:35:57

标签: python python-2.7 pycharm theano macports

我正在尝试安装Theano,所以我可以开始玩一些很酷的ML,但我遇到了PyCharm的问题。我按照说明here来安装所有的先决条件,这样我就可以顺利运行Theano,所以我使用macports下载numpy和scipy,以及python 2.7.12。 PyCharm最初设置为使用usr / bin / python中的解释器(我上次在python中工作时在我的计算机上有一个不同的python版本),但是我将它切换到opt / local / bin / python以便一切都将从相同的macports版本运行。

问题是,使用macports python启动我的PyCharm会在控制台中出现这个错误:

/opt/local/bin/python -u /Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py 60364 60365
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/utils/traitlets.py:5: UserWarning: IPython.utils.traitlets has moved to a top-level traitlets package.
  warn("IPython.utils.traitlets has moved to a top-level traitlets package.")
Traceback (most recent call last):
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 491, in <module>
    pydevconsole.StartServer(pydev_localhost.get_localhost(), int(port), int(client_port))
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydevconsole.py", line 328, in StartServer
    interpreter = InterpreterInterface(host, client_port, threading.currentThread())
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydev_ipython_console.py", line 26, in __init__
    self.interpreter = get_pydev_frontend(host, client_port)
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydev_ipython_console_011.py", line 469, in get_pydev_frontend
    _PyDevFrontEndContainer._instance = _PyDevFrontEnd()
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydev_ipython_console_011.py", line 300, in __init__
    self.ipython = PyDevTerminalInteractiveShell.instance()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/traitlets/config/configurable.py", line 412, in instance
    inst = cls(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/terminal/interactiveshell.py", line 396, in __init__
    super(TerminalInteractiveShell, self).__init__(*args, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/IPython/core/interactiveshell.py", line 495, in __init__
    self.init_completer()
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydev_ipython_console_011.py", line 219, in init_completer
    self.Completer = self._new_completer_200()
  File "/Applications/PyCharm CE.app/Contents/helpers/pydev/pydev_ipython_console_011.py", line 191, in _new_completer_200
    use_readline=self.has_readline,
AttributeError: 'PyDevTerminalInteractiveShell' object has no attribute 'has_readline'

Process finished with exit code 1
Couldn't connect to console process.

我已经完成了一些谷歌搜索,但我能找到的是那些通过更新解决了这个问题的人(我刚刚下载了这个python版本,所以我很确定它是最新版本的),还有那些没有过的人它解决了。有任何想法吗?非常感谢帮助。 :)

编辑:找到this页面,其中人们遇到了类似的错误。有贴片,但我找不到它在我的电脑上的任何地方引用的pydev文件。我还下载了readline库和ipython2.7。仍然没有运气:(

编辑2:修复它!问题出在我的ipython(5.1)上,它与pycharm不兼容。我卸载它并恢复到4.2,这使用控制台清除了错误,但留下了一个关于ipython.utils.traitlets包。为了解决这个问题,我只是禁用了pycharm对ipython的使用。现在一切似乎都很顺利了!

1 个答案:

答案 0 :(得分:0)

修正了它!问题出在我的ipython(5.1)上,它与pycharm不兼容。我卸载它并恢复到4.2,这使用控制台清除了错误,但留下了一个关于ipython.utils.traitlets包。为了解决这个问题,我只是禁用了pycharm对ipython的使用。现在一切似乎都很顺利了!