使 reprexpy 与 PyCharm 和 Python 一起工作 3.9

Making reprexpy work with PyCharm and Python 3.9

我是 Python 和 PyCharm 的新手。我设法安装了包 reprexpy(参见描述 here)但是当我 运行 它时,我收到以下错误:

from reprexpy import reprex
reprex()
Rendering reprex...
Traceback (most recent call last):
(...)
  packages\zmq\asyncio.py", line 56, in _init_io_state
    self.io_loop.add_reader(self._fd, lambda: self._handle_events(0, 0))
  File "C:\Users\Serena\anaconda3\envs\python prep\lib\asyncio\events.py", line 504, in add_reader
    raise NotImplementedError
NotImplementedError

我真的很想完成这项工作,这样我就可以在 Python 中创建可重现的示例。我在 PyCharm (2021.1.1 Pro)

的最新版本上使用 Python 3.9

我成功了。首先,参考这个,我从终端导入asyncio:

 pip install asyncio --upgrade

尝试了两三次。然后我在 之后更改了 __init__.py 文件。终于重新启动 PyCharm,现在 reprex() 正在工作:

range(4)
#> range(0, 4)
for i in range(4):
    print(i)
#> 0
#> 1
#> 2
#> 3

reprexpy package

于 2021-04-28 创建