错误:PythonJWT的构建轮失败

时间:2019-07-11 09:01:12

标签: python-3.x pip jwt

我想使用PythonJWT库处理令牌。但是我坚持在开始。

这是一个简单的Python代码:

#!/usr/bin/python3
import jwt
payload={"email":"myemail@gmail.com"}
print(jwt.encode(payload))

出现以下错误:(我打印了回溯的最后一部分)

Original exception was:
Traceback (most recent call last):
  File "./test_token.py", line 2, in <module>
    import jwt
  File "/usr/lib/python3/dist-packages/jwt/__init__.py", line 19, in <module>
    from .api_jwt import (
  File "/usr/lib/python3/dist-packages/jwt/api_jwt.py", line 1, in <module>
    import json
  File "/home/sinai/python/json.py", line 4, in <module>
    import urllib2
ImportError: No module named 'urllib2'

如果我运行以下命令:

sudo pip3 install urllib2

我得到了错误:

  

收集urllib2

     

错误:找不到满足要求urllib2的版本(来自版本:无)       错误:找不到urllib2的匹配分布

如果我运行sudo pip3 install --upgrade PythonJWT,则会收到错误消息:

ERROR Complete output from command /usr/bin/python3 -u -c 'import setuptools, tokenize;__file__='"'"'/tmp/pip-install-0p1cogz1/PythonJWT/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' bdist_wheel -d /tmp/pip-wheel-118chehm --python-tag cp35:
  ERROR: running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib
  creating build/lib/pythonjwt
  copying pythonjwt/cli.py -> build/lib/pythonjwt
  copying pythonjwt/__init__.py -> build/lib/pythonjwt
  installing to build/bdist.linux-x86_64/wheel
  running install
  Traceback (most recent call last):
    File "<string>", line 1, in <module>
    File "/tmp/pip-install-0p1cogz1/PythonJWT/setup.py", line 47, in <module>
      'pythonjwt = pythonjwt.cli:cli',
    File "/usr/lib/python3.5/distutils/core.py", line 148, in setup
      dist.run_commands()
    File "/usr/lib/python3.5/distutils/dist.py", line 955, in run_commands
      self.run_command(cmd)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/usr/lib/python3/dist-packages/wheel/bdist_wheel.py", line 215, in run
      self.run_command('install')
    File "/usr/lib/python3.5/distutils/cmd.py", line 313, in run_command
      self.distribution.run_command(command)
    File "/usr/lib/python3.5/distutils/dist.py", line 974, in run_command
      cmd_obj.run()
    File "/tmp/pip-install-0p1cogz1/PythonJWT/setup.py", line 20, in run
      raise Exception("You probably meant to install and run python-jwt")
  Exception: You probably meant to install and run python-jwt
  ----------------------------------------
  ERROR: Failed building wheel for PythonJWT

0 个答案:

没有答案