无法在Windows中新安装的Pycharm中启动控制台

时间:2015-03-22 07:38:11

标签: python console pycharm

在Windows 7机器上,新安装了Pycharm(社区或专业)和Python 3.4(尝试过Anaconda 3)。在主编辑器中以交互方式运行Python脚本没有问题。但是,当我尝试选择查看>工具窗口> Python控制台,它会生成以下错误消息等。基本上,我无法在Pycharm中调出一个控制台窗口。

C:\Users\user\Anaconda3\python.exe -u C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevconsole.py 56743 56744
Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydev_imports.py", line 21, in <module>
    from SimpleXMLRPCServer import SimpleXMLRPCServer
ImportError: No module named 'SimpleXMLRPCServer'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Program Files (x86)\JetBrains\PyCharm     4.0.5\helpers\pydev\pydevconsole.py", line 20, in <module>
    import pydevd_vars
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevd_vars.py", line 9, in <module>
    from pydevd_xml import *
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydevd_xml.py", line 7, in <module>
    from pydev_imports import quote
  File "C:\Program Files (x86)\JetBrains\PyCharm 4.0.5\helpers\pydev\pydev_imports.py", line 23, in <module>
    from xmlrpc.server import SimpleXMLRPCServer
  File "C:\Users\user\Anaconda3\lib\xmlrpc\server.py", line 108, in <module>
    from http.server import BaseHTTPRequestHandler
  File "C:\Users\user\Anaconda3\lib\http\server.py", line 660, in <module>
    class SimpleHTTPRequestHandler(BaseHTTPRequestHandler):
  File "C:\Users\user\Anaconda3\lib\http\server.py", line 851, in SimpleHTTPRequestHandler
    mimetypes.init() # try to read system mime.types
  File "C:\Users\user\Anaconda3\lib\mimetypes.py", line 348, in init
    db.read_windows_registry()
  File "C:\Users\user\Anaconda3\lib\mimetypes.py", line 255, in read_windows_registry
    with _winreg.OpenKey(hkcr, subkeyname) as subkey:
TypeError: OpenKey() argument 2 must be str without null characters or None, not str

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

-----------------这些消息显示在&#34; Python控制台&#34; -------------

4 个答案:

答案 0 :(得分:4)

您需要更改工作目录。转到File->Settings->Build, Execution, Deployment->Console->Python Console,然后在Working directory框中更改或提供您具有读写权限的目录。

答案 1 :(得分:2)

在存在各种开发配置的情况下配置pycharm是一种黑色艺术恕我直言。 我找到的最有效的机制是将随机字符串放入各种设置对话框,解释器,控制台,测试,服务器,并仔细观察提交给解释器的命令行。 几乎不是一个令人满意的方法,但它会弄清楚什么在哪里以及在某种程度上影响什么。

另一个认为帮助我的是工作安装的设置和测试对话框的截图。

再一次,有点粗糙,准备好了,但经过长时间的成功调试,然后是pycharm健忘症,它又让我恢复活力。

答案 2 :(得分:0)

我有同样的问题。我重新安装了python,默认目录也发生了变化。

然后我在这里更新了翻译File->Settings->Build, Execution, Deployment->Console->Python Console ,此处 File->Settings->Project: <YOUR_PROJECT>->Project Interpreter

如果您要打开新项目,口译员需要再次选择(?)

答案 3 :(得分:0)

我通过在“首选项”和项目解释器中设置解释器来解决该问题。