我有这个 python 代码,我想从 Windows Run 运行它。但是,当我尝试运行它时,cmd 会显示此消息。
C:\Users\myName\AppData\Local\Programs\Python\Python38-32\python.exe: can't find '__main__' module in 'C:\\Users\\myName\\OneDrive'
我正在使用 VS Code 在 python 3.8.3 32 位虚拟环境中编写我的程序。python程序称为pw.py,批处理文件称为pw.bat
pw.py
C:\Users\myName\OneDrive - 公司名称\04Programming\01 Visual Studio Code\LearningPython\pw.py
#! python3
# pw.py - An insecure password locker program.
import sys, pyperclip
PASSWORD = {'email': 'F7minlBDDuvMJuxESSKHFhTxFtjVB6',
'blog': 'VmAlvQyKAxiVH5G8vo1if1MLZF3sdt',
'luggage': '12345'}
if len(sys.argv) < 2:
print('Usage: python pw.py [account] - copy account password')
sys.exit()
account = sys.argv[1] # first commmand line arg is the account name
if account in PASSWORD:
pyperclip.copy(PASSWORD[account])
print('Password for ' + account + ' copied to clipboard.')
else:
print('There is no account named ' + account)
密码蝙蝠
C:\Users\myName\MyPythonScripts
@py.exe C:\Users\myName\OneDrive - companyName\04 Programming\01 Visual Studio Code\LearningPython\pw.py %*
@pause
扬帆大鱼
相关分类