刚开始学习Python。我在使用 Pyperclip 模块时遇到了问题。
当我尝试在命令行中使用 pip install pyperclip
时,它显示了这个错误:
pip install pyperclip
^
SyntaxError: invalid syntax
我在 Windows 7 桌面上运行 Python 3.5(32 位)。
最佳答案
open command prompt type: pip install pyperclip
如果这不起作用,那么就使用这个 cd Python35/Scripts 进入脚本文件夹 这是pip所在的文件夹。
Now type: pip install pyperclip
这将下载并安装 pyperclip
now type: pip freeze
应该列出 pyperclip
如果你想在 python shell 中进行测试,请记住关闭 shell(如果打开)并打开一个新的,因为它需要加载新的包。
type in python shell: import pyperclip
它应该接受它,现在你可以使用 pyperclip.copy() 和 pyperclip.paste()
祝你好运!
关于Python 3.5 Pyperclip 模块导入失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33469015/