level 3
钟丁葵川爱半沐2F
楼主
我用pip insnall pynput 安装了pynput 1.6.8 ,project interpreter里面也能看到pynput了,复制以下pypi官方代码到pycharm里面,运行报错ModuleNotFoundError: No module named 'pynput.mouse'; 'pynput' is not a package
代码就是官方的例子:
from pynput.mouse import Button, Controller
mouse = Controller()
# Read pointer position
print('The current pointer position is {0}'.format(
mouse.position))
# Set pointer position
mouse.position = (10, 20)
print('Now we have moved it to {0}'.format(
mouse.position))
# Move pointer relative to current position
mouse.move(5, -5)
# Press and release
mouse.press(Button.left)
mouse.release(Button.left)
# Double click; this is different from pressing and releasing
# twice on Mac OSX
mouse.click(Button.left, 2)
# Scroll two steps down
mouse.scroll(0, 2)
请问这是什么原因啊,是pynput没装好吗?
2020年07月20日 17点07分
1
代码就是官方的例子:
from pynput.mouse import Button, Controller
mouse = Controller()
# Read pointer position
print('The current pointer position is {0}'.format(
mouse.position))
# Set pointer position
mouse.position = (10, 20)
print('Now we have moved it to {0}'.format(
mouse.position))
# Move pointer relative to current position
mouse.move(5, -5)
# Press and release
mouse.press(Button.left)
mouse.release(Button.left)
# Double click; this is different from pressing and releasing
# twice on Mac OSX
mouse.click(Button.left, 2)
# Scroll two steps down
mouse.scroll(0, 2)
请问这是什么原因啊,是pynput没装好吗?