代码内容如下
# -*- coding:utf-8 -*- #! /usr/bin/env python3 import requests #引入 requests 库 运行代码后
出现错误提示
AttributeError: '_SixMetaPathImporter' object has no attribute 'find_spec',
TypeError: 'int' object is not callable
完整错误提示如下
Traceback (most recent call last): File "<frozen importlib._bootstrap>", line 900, in _find_spec AttributeError: '_SixMetaPathImporter' object has no attribute 'find_spec' During handling of the above exception, another exception occurred: Traceback (most recent call last): File "/Users/noogler/Documents/python_files_sublimetext3/practice/draft7.py", line 3, in <module> import requests File "/usr/local/lib/python3.7/site-packages/requests/__init__.py", line 43, in <module> import urllib3 File "/usr/local/lib/python3.7/site-packages/urllib3/__init__.py", line 7, in <module> from .connectionpool import HTTPConnectionPool, HTTPSConnectionPool, connection_from_url File "/usr/local/lib/python3.7/site-packages/urllib3/connectionpool.py", line 11, in <module> from .exceptions import ( File "/usr/local/lib/python3.7/site-packages/urllib3/exceptions.py", line 2, in <module> from .packages.six.moves.http_client import IncompleteRead as httplib_IncompleteRead File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 963, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 902, in _find_spec File "<frozen importlib._bootstrap>", line 879, in _find_spec_legacy File "<frozen importlib._bootstrap>", line 449, in spec_from_loader File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 212, in is_package return hasattr(self.__get_module(fullname), "__path__") File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 116, in __getattr__ _module = self._resolve() File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 113, in _resolve return _import_module(self.mod) File "/usr/local/lib/python3.7/site-packages/urllib3/packages/six.py", line 82, in _import_module __import__(name) File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/http/client.py", line 71, in <module> import email.parser File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/email/parser.py", line 12, in <module> from email.feedparser import FeedParser, BytesFeedParser File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/email/feedparser.py", line 27, in <module> from email._policybase import compat32 File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/email/_policybase.py", line 9, in <module> from email.utils import _has_surrogates File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/email/utils.py", line 33, in <module> from email._parseaddr import quote File "/usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/email/_parseaddr.py", line 16, in <module> import time, calendar File "/Users/noogler/Documents/python_files_sublimetext3/practice/calendar.py", line 9, in <module> cal = calendar.month(year,month) TypeError: 'int' object is not callable [Finished in 0.1s with exit code 1] [cmd: ['/usr/local/bin/python3', '-u', '/Users/noogler/Documents/python_files_sublimetext3/practice/draft7.py']] [dir: /Users/noogler/Documents/python_files_sublimetext3/practice] [path: /usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/aria2/bin:/usr/local/share/dotnet:~/.dotnet/tools:/Library/Frameworks/Mono.framework/Versions/Current/Commands] 问题补充
import pygame 库是正常的
pygame 1.9.6 Hello from the pygame community. https://www.pygame.org/contribute.html [Finished in 0.2s] 初学 python 不久,不确定还需要补充哪些信息帮忙定位,我会继续补充 自己 Google 了 2 天了还是没解决,希望有好心大佬帮忙,感激不尽
