来自官方 winshell 网站的示例 https://winshell.readthedocs.io/en/latest/cookbook/shortcuts.html#create-a-shortcut-to-a-file
import os, sys
import winshell
shortcut = winshell.shortcut(sys.executable)
shortcut.working_directory = "c:/temp"
shortcut.write(os.path.join(winshell.desktop(), "python.lnk"))
shortcut.dump()
安装库时(https://winshell.readthedocs.io/en/latest/index.html)
pip install winshell
给出以下消息
PS C:\Users\bro> pip install winshell
Requirement already satisfied: winshell in c:\python\python312\lib\site-packages (0.6)
运行脚本时,会出现错误
"C:\Python\proekt\09 - Создание прфиля chrome\pythonProject\.venv\Scripts\python.exe" "C:\Python\proekt\09 - Создание прфиля chrome\pythonProject\main.py"
Traceback (most recent call last):
File "C:\Python\proekt\09 - Создание профиля chrome\pythonProject\main.py", line 3, in <module>
import winshell
ModuleNotFoundError: No module named 'winshell'
那么如何安装winshell库并使用它呢?