简体   繁体   English

为什么 PyCharm 无法导入模块?

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

OS- Neon Linux I have the following command line output: 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

It seems lbp script runs.似乎lbp脚本运行。 Now I trying to run it in PyCharm 2022.2.2 Please see screenshots现在我尝试在 PyCharm 2022.2.2 中运行它 请看截图在此处输入图像描述 在此处输入图像描述

Please tell me, why PyCharm can't import a module?请告诉我,为什么 PyCharm 不能导入模块?

I have found the solution!我找到了解决方案!

File -> Settings -> Project: 'myprojectname' -> Python Interpreter -> Add Interpreter Then set up the following parameters File -> Settings -> Project: 'myprojectname' -> Python Interpreter -> Add Interpreter 然后设置如下参数在此处输入图像描述

Then in "Run configuration" select newly created interpreter然后在“运行配置” select 新创建的解释器

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM