簡體   English   中英

為什么 PyCharm 無法導入模塊?

[英]Why PyCharm couldn't import a module?

OS- Neon Linux 我有以下命令行 output:

katya7@katya7-comp:/home/katya/work/prostor/okular_gost$ /home/katya/work/prostor/cuisine/cuisine/lbp -b okular_gost.yml source -f okular_gost bullseye
/home/katya/work/prostor/cuisine/cuisine/cuisine/program.py:86: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
  options.update(**yaml.load(ymlfile))
/usr/lib/python3/dist-packages/debian/changelog.py:484: UserWarning: Found eof where expected first heading
  warnings.warn(message)
Копирование debian/21.11.70.21 в /home/katya/work/prostor/cuisine/build/okular_gost/ 
Модификация debian/control 
Traceback (most recent call last):
  File "/home/katya/work/prostor/cuisine/cuisine/lbp", line 222, in <module>
    args.func(args)
  File "/home/katya/work/prostor/cuisine/cuisine/lbp", line 120, in do_source
    source.prepare(profile)
  File "/home/katya/work/prostor/cuisine/cuisine/cuisine/source.py", line 59, in prepare
    self.prepare_debian(profile)
  File "/home/katya/work/prostor/cuisine/cuisine/cuisine/source.py", line 194, in prepare_debian
    self.prepare_control(profile)
  File "/home/katya/work/prostor/cuisine/cuisine/cuisine/source.py", line 206, in prepare_control
    self._control = Control(self, filename=self.path.joinpath(self.controlfile))
  File "/usr/lib/python3.8/pathlib.py", line 931, in joinpath
    return self._make_child(args)
  File "/usr/lib/python3.8/pathlib.py", line 713, in _make_child
    drv, root, parts = self._parse_args(args)
  File "/usr/lib/python3.8/pathlib.py", line 667, in _parse_args
    a = os.fspath(a)
TypeError: expected str, bytes or os.PathLike object, not NoneType

似乎lbp腳本運行。 現在我嘗試在 PyCharm 2022.2.2 中運行它 請看截圖在此處輸入圖像描述 在此處輸入圖像描述

請告訴我,為什么 PyCharm 不能導入模塊?

我找到了解決方案!

File -> Settings -> Project: 'myprojectname' -> Python Interpreter -> Add Interpreter 然后設置如下參數在此處輸入圖像描述

然后在“運行配置” select 新創建的解釋器

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM