没有名为“请求工具带”的模块

2024-04-25 12:16:03 发布

您现在位置:Python中文网/ 问答频道 /正文

所以,我试图将我的python应用程序上传到heroku,但是当我使用带有“requests_toolbelt”的脚本时,它说找不到。

这是我的日志:

Traceback (most recent call last):
  File "girl.py", line 12, in <module>
    from Coffe import CoffeAPI
  File "/app/CoffeAPI/__init__.py", line 29, in <module>
    from requests_toolbelt import MultipartEncoder
ImportError: No module named 'requests_toolbelt'

这里是我的requeriments.txt:

requests-toolbelt==0.7.1
moviepy==0.2.2.11
requests==2.13.0

我是否需要一个特定的构建包来运行“请求工具带”?


Tags: infrompyimport脚本应用程序mostheroku
3条回答

是否尝试使用命令行安装程序包? 将命令行导航到安装了python的路径:

>path\easy_install.exe requests_toolbelt

或者

>path\easy_install.exe requests-toolbelt

或者

>path\python -m pip install requests_toolbelt

希望这对你有帮助

我也有同样的问题,我的解决办法是

the package was installed by root user

在更改了文件的访问属性之后,它运行良好。
我特别发出的命令(在类似ubuntu的系统上)是:

sudo chown $USER.$USER -R ~/.local/lib/python3.7/site-packages/

尝试安装请求工具带。使用下面的命令来执行此操作。

# pip install requests-toolbelt

相关问题 更多 >