ImportError: No module named pytz
Posted sea-stream
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ImportError: No module named pytz相关的知识,希望对你有一定的参考价值。
[email protected]:/opt/xx/cc$ python manage.py runserver 0.0.0.0:8814 Traceback (most recent call last): File "manage.py", line 9, in <module> from django.core.management import execute_from_command_line File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/core/management/__init__.py", line 13, in <module> from django.core.management.base import ( File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/core/management/base.py", line 17, in <module> from django.db.migrations.exceptions import MigrationSchemaMissing File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/db/migrations/__init__.py", line 2, in <module> from .operations import * # NOQA File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/db/migrations/operations/__init__.py", line 1, in <module> from .fields import AddField, AlterField, RemoveField, RenameField File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/db/migrations/operations/fields.py", line 4, in <module> from django.db.models.fields import NOT_PROVIDED File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/db/models/__init__.py", line 3, in <module> from django.db.models.aggregates import * # NOQA File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/db/models/aggregates.py", line 5, in <module> from django.db.models.expressions import Func, Star File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/db/models/expressions.py", line 5, in <module> from django.db.backends import utils as backend_utils File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/db/backends/utils.py", line 12, in <module> from django.utils.timezone import utc File "/usr/local/lib/python2.7/dist-packages/Django-1.11.3-py2.7.egg/django/utils/timezone.py", line 8, in <module> import pytz ImportError: No module named pytz
安装
pip install pytz
再次报错
[email protected]:/opt/xx/cc$ pip install pytz Downloading/unpacking pytz Downloading pytz-2019.1-py2.py3-none-any.whl (510kB): 510kB downloaded Installing collected packages: pytz Cleaning up... Exception: Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pip/basecommand.py", line 122, in main status = self.run(options, args) File "/usr/lib/python2.7/dist-packages/pip/commands/install.py", line 283, in run requirement_set.install(install_options, global_options, root=options.root_path) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 1436, in install requirement.install(install_options, global_options, *args, **kwargs) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 672, in install self.move_wheel_files(self.source_dir, root=root) File "/usr/lib/python2.7/dist-packages/pip/req.py", line 902, in move_wheel_files pycompile=self.pycompile, File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 206, in move_wheel_files clobber(source, lib_dir, True) File "/usr/lib/python2.7/dist-packages/pip/wheel.py", line 193, in clobber os.makedirs(destsubdir) File "/usr/lib/python2.7/os.py", line 157, in makedirs mkdir(name, mode) OSError: [Errno 13] Permission denied: ‘/usr/local/lib/python2.7/dist-packages/pytz-2019.1.dist-info‘ Storing debug log for failure in /tmp/tmpbGaHeV
使用sudo权限
sudo pip install pytz
安装成功
[email protected]:/opt/xx/cc$ sudo pip install pytz Downloading/unpacking pytz Downloading pytz-2019.1-py2.py3-none-any.whl (510kB): 510kB downloaded Installing collected packages: pytz Successfully installed pytz Cleaning up... [email protected]:/opt/xx/cc$
参考:
https://blog.csdn.net/qq_38157974/article/details/78521088
以上是关于ImportError: No module named pytz的主要内容,如果未能解决你的问题,请参考以下文章
ImportError : No module named graphics
python27 ImportError: No module named site
Python中ImportError: No module named request
ImportError: No module named win32api