让reprexpy与PyCharm和Python 3.9一起工作

2024-04-20 00:46:46 发布

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

我不熟悉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


Tags: inpyioself程序包addasyncioline
1条回答
网友
1楼 · 发布于 2024-04-20 00:46:46

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

 pip install asyncio  upgrade

那需要两三次尝试。然后,我在这个answer之后更改了__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创建

相关问题 更多 >