sách gpt4 ai đã đi

Tập lệnh python của tôi chạy qua IDE của tôi (PyCharm) nhưng không sử dụng shell Python

In lại 作者:行者123 更新时间:2023-12-01 05:46:45 28 4
mua khóa gpt4 Nike

我有一个简短的 python 脚本,它使用日志记录模块和 configparser 模块。我在Win7下使用PyCharm 2.7.1和Python 3.3。

当我使用 PyCharm 运行我的脚本时 - 它有效。这是 PyCharm 控制台的输出:

C:\Python33\python.exe C:/some/path/script.py

Process finished with exit code 0

我在 cmd 中运行相同的命令,这就是我得到的结果:

C:\>C:\Python33\python.exe C:/some/path/script.py
Theo dõi (cuộc gọi gần đây nhất là cuộc gọi cuối cùng):
File "C:/some/path/script.py", line 10
1, in
initLogger()
File "C:/some/path/script.py", line 97, in initLogger
logging.config.fileConfig('RecorderMoverLog.config.ini')
File "C:\Python33\lib\logging\config.py", line 70, in fileConfig
formatters = _create_formatters(cp)
File "C:\Python33\lib\logging\config.py", line 103, in _create_formatters
flist = cp["formatters"]["keys"]
File "C:\Python33\lib\configparser.py", line 942, in __getitem__
raise KeyError(key)
KeyError: 'formatters'

为什么它可以在 PyCharm 中运行而不能在 python shell 下运行?

Cảm ơn

1 Câu trả lời

这很可能是因为您的 PYTHON_PATH。在 Python IDE 和 shell 中的 Python 中列出 hệ thống.đường dẫn。查找 Python 库中的差异。

关于python - 我的 python 脚本通过我的 IDE (PyCharm) 运行,但无法使用 Python shell 运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15837544/

28 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com