ubuntu将默认使用python2更改为默认使用python3的方法
直接执行这两个命令即可:
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100 sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150
操作剪贴板
import pyperclip pyperclip.copy("写入剪贴板的内容") url =pyperclip.paste() linux error------- Traceback (most recent call last): File "/home/diao/python/qrcode.py", line 7, in <module> url =pyperclip.paste() File "/usr/local/lib/python3.7/dist-packages/pyperclip/__init__.py", line 640, in lazy_load_stub_paste return paste() File "/usr/local/lib/python3.7/dist-packages/pyperclip/__init__.py", line 303, in __call__ raise PyperclipException(EXCEPT_MSG) pyperclip.PyperclipException: Pyperclip could not find a copy/paste mechanism for your system. For more information
解决方法
sudo apt-get install xsel to install the xsel utility. sudo apt-get install xclip to install the xclip utility. pip install gtk to install the gtk Python module. pip install PyQt4 to install the PyQt4 Python module.