ModuleNotFoundError:没有名为“ requests_html” Twetter的模块

时间:2020-04-01 08:41:50

标签: python pip

当前,我正在Covid-19情感分析中,我正在使用twitter_scraper抓取我的数据。 运行以下代码行后,我得到一个错误。

from twitter_scraper import get_tweets

ModuleNotFoundError:没有名为“ requests_html”的模块

我通过运行以下命令安装“ requests_html”:

pip3 install requests-html

在命令提示符下执行此命令后,我也遇到一些错误

Exception:

Traceback (most recent call last):

  File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 215, in main

  status = self.run(options, args)

  File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 360, in run

  prefix=options.prefix_path,

  File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 784, in install

  **kwargs

  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 851, in install

  self.move_wheel_files(self.source_dir, root=root, prefix=prefix)

  File "/usr/lib/python3/dist-packages/pip/req/req_install.py", line 1064, in move_wheel_files

  isolated=self.isolated,

  File "/usr/lib/python3/dist-packages/pip/wheel.py", line 247, in move_wheel_files  

prefix=prefix,

  File "/usr/lib/python3/dist-packages/pip/locations.py", line 153, in distutils_scheme

  i.finalize_options()

  File "/usr/lib/python3.6/distutils/command/install.py", line 351, in finalize_options

  self.create_home_path()

  File "/usr/lib/python3.6/distutils/command/install.py", line 581, in create_home_path

  os.makedirs(path, 0o700)

  File "/usr/lib/python3.6/os.py", line 210, in makedirs

  makedirs(head, mode, exist_ok)

  File "/usr/lib/python3.6/os.py", line 220, in makedirs

  mkdir(name, mode)

PermissionError: [Errno 13] Permission denied: '/home/subhash/.local/lib/python3.6'

有人可以帮我吗?

1 个答案:

答案 0 :(得分:1)

Pip默认将Python软件包安装到需要root访问权限的系统目录中。

您具有root权限吗?如果是这样,请尝试运行sudo pip install...。 否则,请考虑将依赖项安装到您的主目录,而不需要任何特殊特权:

pip install --user requests-html