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

2024-05-23 14:59:00 发布

您现在位置:Python中文网/ 问答频道 /正文

在Windows7机器上,Pycharm(社区或专业版)和Python3.4(也有尝试过的Anaconda3)是新安装的。在主编辑器中以交互方式运行Python脚本没有问题。但是,当我尝试选择View>;Tool Windows>;Python Console时,它会生成以下错误消息和更多信息。基本上,我无法在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.

—————————————————————————————————————————————————


Tags: inpylinefilesprogramusersx86helpers
3条回答

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

我也有同样的问题。我重新安装了python,默认目录已经改变。

然后我刷新了这里的解释器File->Settings->Build, Execution, Deployment->Console->Python Console和这里的File->Settings->Project: <YOUR_PROJECT>->Project Interpreter

如果您要打开新的项目,解释器将需要再次选择(?)

pycharm在各种开发配置中的配置有点像黑色艺术。 我发现的最有效的机制是将随机字符串放入各种设置对话框、解释器、控制台、测试、服务器中,并仔细观察提交给解释器的命令行。 这不是一个令人满意的方法,但它能在一定程度上解决什么会对什么产生影响。

另一个帮助我的想法是设置屏幕截图和测试对话框的工作安装。

再一次,有点粗糙和准备好了,但它让我重新站起来,运行后,一个长期的成功调试后,皮查姆健忘症。

相关问题 更多 >