【问题标题】:import-im6.q16: not authorized `requests' @ error/constitute.c/WriteImage/1037 [duplicate]import-im6.q16:未授权“请求”@错误/构成.c/WriteImage/1037 [重复]
【发布时间】:2020-07-25 00:00:02
【问题描述】:

我已经在 python 2.7 中安装了 requests 模块,但是在导入它时给了我

import-im6.q16: not authorized `requests' @ error/constitute.c/WriteImage/1037

这是为什么呢?

【问题讨论】:

    标签: python python-2.7 python-requests


    【解决方案1】:

    您收到此错误是因为您的脚本不是由 python 执行的,但很可能是由 bash 执行的。

    您看到的错误可能是由import 可执行文件(它是ImageMagick 的一部分)产生的。如果你尝试执行,在 bash 中:

    $ import requests
    

    您可能会得到相同的输出。


    要正确执行你的脚本,你需要使用python:

    $ python your_script.py
    

    或者

    1. 您可以确保脚本的第一行正好是#!/usr/bin/env python
    2. 使您的脚本可执行:
      $ chmod +x your_script.py
      
    3. 执行它而不在前面输入python:
      $ ./your_script.py
      

    【讨论】:

      猜你喜欢
      • 2020-01-10
      • 2019-08-28
      • 2021-05-12
      • 2017-08-13
      • 2021-09-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-25
      相关资源
      最近更新 更多