没有名为 'Twisted' 的模块
No module named 'Twisted'
我刚刚安装了 Python 开始尝试使用 Scrapy。
找到了一个首先安装 Miniconda 的教程,有了这个我就可以安装 Scrapy。现在的问题是我尝试 运行 的软件也需要 Twisted。所以我用pip安装了twisted。
Twisted 似乎已正确安装,但在 运行 无法找到 Twisted 模块的脚本时我仍然遇到错误。
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\xampp\htdocs\crawler\crawler.py ================
Traceback (most recent call last):
File "C:\xampp\htdocs\crawler\crawler.py", line 3, in <module>
from scrapy.utils.project import get_project_settings
File "C:\xampp\htdocs\crawler\scrapy\__init__.py", line 43, in <module>
from twisted import version as _txv
ModuleNotFoundError: No module named 'twisted'
>>>
================ RESTART: C:\xampp\htdocs\crawler\crawler.py ================
Traceback (most recent call last):
File "C:\xampp\htdocs\crawler\crawler.py", line 3, in <module>
from scrapy.utils.project import get_project_settings
File "C:\xampp\htdocs\crawler\scrapy\__init__.py", line 43, in <module>
from twisted import version as _txv
ModuleNotFoundError: No module named 'twisted'
>>>
有什么建议吗?
提前致谢,
您为 python2 安装了 twisted。当您使用命令 pip
时,您正在为 python2 安装一个包。您正在使用 python3 (3.6.3)。要为 python3 安装 twisted,您必须执行以下操作:
pip3 install twisted
希望对您有所帮助。
要尝试是否正确安装了 twisted,请启动 python 解释器并键入
import twisted
如果您无法导入 twisted,您应该检查它是否在您的 python 路径中。
Python 路径可以在 python 解释器中检查为
import sys
print sys.path
安装你的twisted的目录必须在这些文件夹中。
我刚刚安装了 Python 开始尝试使用 Scrapy。 找到了一个首先安装 Miniconda 的教程,有了这个我就可以安装 Scrapy。现在的问题是我尝试 运行 的软件也需要 Twisted。所以我用pip安装了twisted。
Twisted 似乎已正确安装,但在 运行 无法找到 Twisted 模块的脚本时我仍然遇到错误。
Python 3.6.3 (v3.6.3:2c5fed8, Oct 3 2017, 17:26:49) [MSC v.1900 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>>
================ RESTART: C:\xampp\htdocs\crawler\crawler.py ================
Traceback (most recent call last):
File "C:\xampp\htdocs\crawler\crawler.py", line 3, in <module>
from scrapy.utils.project import get_project_settings
File "C:\xampp\htdocs\crawler\scrapy\__init__.py", line 43, in <module>
from twisted import version as _txv
ModuleNotFoundError: No module named 'twisted'
>>>
================ RESTART: C:\xampp\htdocs\crawler\crawler.py ================
Traceback (most recent call last):
File "C:\xampp\htdocs\crawler\crawler.py", line 3, in <module>
from scrapy.utils.project import get_project_settings
File "C:\xampp\htdocs\crawler\scrapy\__init__.py", line 43, in <module>
from twisted import version as _txv
ModuleNotFoundError: No module named 'twisted'
>>>
有什么建议吗?
提前致谢,
您为 python2 安装了 twisted。当您使用命令 pip
时,您正在为 python2 安装一个包。您正在使用 python3 (3.6.3)。要为 python3 安装 twisted,您必须执行以下操作:
pip3 install twisted
希望对您有所帮助。
要尝试是否正确安装了 twisted,请启动 python 解释器并键入
import twisted
如果您无法导入 twisted,您应该检查它是否在您的 python 路径中。 Python 路径可以在 python 解释器中检查为
import sys
print sys.path
安装你的twisted的目录必须在这些文件夹中。