gpt4 book ai didi

python - 如何为我的 PyCharm Python 项目安装 yaml 包?

转载 作者:行者123 更新时间:2023-12-05 02:14:04 25 4
gpt4 key购买 nike

我将 PyCharm 2018.2.4 与 Python 3.7 结合使用。我想运行一些种子数据,所以在 Python 管理控制台中,我尝试运行我的 yaml 文件,但以这个错误结束

manage.py@mainpage_project > loaddata seed_data
bash -cl "/Users/davea/Documents/workspace/mainpage_project/venv/bin/python /Applications/PyCharm.app/Contents/helpers/pycharm/django_manage.py loaddata seed_data /Users/davea/Documents/workspace/mainpage_project"
Tracking file by folder pattern: migrations
/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 wheel package will be renamed from release 2.8; in order to keep installing from binary please use "pip install psycopg2-binary" instead. For details see: <http://initd.org/psycopg/docs/install.html#binary-install-from-pypi>.
""")
Traceback (most recent call last):
File "/Applications/PyCharm.app/Contents/helpers/pycharm/django_manage.py", line 52, in <module>
run_command()
File "/Applications/PyCharm.app/Contents/helpers/pycharm/django_manage.py", line 46, in run_command
run_module(manage_file, None, '__main__', True)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 205, in run_module
return _run_module_code(code, init_globals, run_name, mod_spec)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/davea/Documents/workspace/mainpage_project/manage.py", line 15, in <module>
execute_from_command_line(sys.argv)
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 381, in execute_from_command_line
utility.execute()
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/management/__init__.py", line 375, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/management/base.py", line 316, in run_from_argv
self.execute(*args, **cmd_options)
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/management/base.py", line 353, in execute
output = self.handle(*args, **options)
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/management/commands/loaddata.py", line 72, in handle
self.loaddata(fixture_labels)
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/management/commands/loaddata.py", line 113, in loaddata
self.load_label(fixture_label)
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/management/commands/loaddata.py", line 165, in load_label
ser_fmt, fixture, using=self.using, ignorenonexistent=self.ignore,
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/serializers/__init__.py", line 140, in deserialize
return d(stream_or_string, **options)
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/serializers/__init__.py", line 50, in __call__
raise self.exception
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/serializers/__init__.py", line 70, in register_serializer
module = importlib.import_module(serializer_module)
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/importlib/__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 677, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 728, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/Users/davea/Documents/workspace/mainpage_project/venv/lib/python3.7/site-packages/django/core/serializers/pyyaml.py", line 11, in <module>
import yaml
ModuleNotFoundError: No module named 'yaml'

so then I opened up my Project Interpreter page, selected the "yaml" module and clicked "Install". However it didn't install and instead gave me this error ...

收集yaml

  Could not find a version that satisfies the requirement yaml (from versions: )
No matching distribution found for yaml

如何为 PyCharm 安装 Yaml?

最佳答案

我认为你正在寻找 pyyaml

https://pypi.org/project/PyYAML/

关于python - 如何为我的 PyCharm Python 项目安装 yaml 包?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54335953/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com