gpt4 book ai didi

python - Django,python3,安装时我得到 : "Parent module ' setuptools' not loaded"

转载 作者:行者123 更新时间:2023-12-04 18:49:35 27 4
gpt4 key购买 nike

我看到很多关于 Parent module '' not loaded, ... 的错误和建议
我没有看到任何关于“开箱即用”的 django 3.5。

$ mkvirtualenv foobar -p /usr/bin/python3
Already using interpreter /usr/bin/python3
Using base prefix '/usr'
New python executable in /home/isaac/.virtualenvs/foobar/bin/python3
Also creating executable in /home/isaac/.virtualenvs/foobar/bin/python
Installing setuptools, pkg_resources, pip, wheel...done.

[foobar] $ pip install django
Collecting django
Using cached Django-2.2.15-py3-none-any.whl (7.5 MB)
Collecting pytz
Using cached pytz-2020.1-py2.py3-none-any.whl (510 kB)
Collecting sqlparse>=0.2.2
Using cached sqlparse-0.3.1-py2.py3-none-any.whl (40 kB)
Installing collected packages: pytz, sqlparse, django
Successfully installed django-2.2.15 pytz-2020.1 sqlparse-0.3.1

[foobar] $ python
Python 3.5.3 (default, Jul 9 2020, 13:00:10)
[GCC 6.3.0 20170516] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import django
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/isaac/.virtualenvs/foobar/lib/python3.5/site-packages/django/__init__.py", line 1, in <module>
from django.utils.version import get_version
File "/home/isaac/.virtualenvs/foobar/lib/python3.5/site-packages/django/utils/version.py", line 6, in <module>
from distutils.version import LooseVersion
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 666, in _load_unlocked
File "<frozen importlib._bootstrap>", line 577, in module_from_spec
File "/home/isaac/.virtualenvs/foobar/lib/python3.5/site-packages/_distutils_hack/__init__.py", line 82, in create_module
return importlib.import_module('._distutils', 'setuptools')
File "/home/isaac/.virtualenvs/foobar/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 981, in _gcd_import
File "<frozen importlib._bootstrap>", line 931, in _sanity_check
SystemError: Parent module 'setuptools' not loaded, cannot perform relative import
如您所见,我使用 python3.5 安装了 django。
它似乎与 python2.7 一起工作正常......
有没有其他人知道解决这个错误的方法,或者我在我的环境中做了什么愚蠢的事情?
我正在使用 debian 拉伸(stretch)而不是 buster,但我不确定我是否准备好升级。

最佳答案

setuptools 版本 50 中发生了一些事情。
我们可以通过将 setuptools 降级到 49.3.0(也许 pip 到 20.2.1)来“解决”这个问题pip install setuptools==49.3.0pip install pip==20.2.1请注意,这应该只是一个临时解决方案!

关于python - Django,python3,安装时我得到 : "Parent module ' setuptools' not loaded",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63670999/

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