[英]can't import six.moves module
import json
from six.moves.urllib_parse import urlencode
from six.moves.urllib_request import urlopen
from django.core.management.base import CommandError
def call(method, data, post=False):
"""
Calls `method` from the DISQUS API with data either in POST or GET.
Returns deserialized JSON response.
"""
url = "%s%s" % ("http://disqus.com/api/", method)
if post:
# POST request
url += "/"
data = urlencode(data)
else:
# GET request
url += "?%s" % urlencode(data)
data = ""
res = json.load(urlopen(url, data))
if not res["succeeded"]:
raise CommandError(
"'%s' failed: %s\nData: %s" % (method, res["code"], data)
)
return res["message"]
module) moves
模块)移动
Import "six.moves.urllib_parse" could not be resolved from sourcePylancereportMissingModuleSource无法从 sourcePylancereportMissingModuleSource 解析导入“six.moves.urllib_parse”
installed the six module to Python virtual environment将六个模块安装到 Python 虚拟环境
six can be imported without problems,六个可以毫无问题地导入,
Occurs from six.moves MissingModuleSource发生在 six.moves MissingModuleSource
Why can't Import?为什么不能导入? six.moves
六步
try changing system interpreter path of python in your IDE and set it to the virtual environment you use, in which you have installed the module.尝试更改 IDE 中 python 的系统解释器路径,并将其设置为您使用的虚拟环境,您已经在其中安装了该模块。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.