加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Python > 正文

Python 3的tox调用失败

发布时间:2020-12-20 11:49:34 所属栏目:Python 来源:网络整理
导读:tox运行我的 Python 2.7测试,但是Python 3.4失败了.它给出了“调用失败”消息.摘录: py34 create: /home/josh/code/ezoutlet/.tox/py34ERROR: invocation failed (exit code 1),logfile: /home/josh/code/ezoutlet/.tox/py34/log/py34-0.logERROR: actionid
tox运行我的 Python 2.7测试,但是Python 3.4失败了.它给出了“调用失败”消息.摘录:

py34 create: /home/josh/code/ezoutlet/.tox/py34
ERROR: invocation failed (exit code 1),logfile: /home/josh/code/ezoutlet/.tox/py34/log/py34-0.log
ERROR: actionid: py34
msg: getenv
cmdargs: ['/usr/bin/python','-m','virtualenv','--python','/usr/bin/python3.4','py34']

然后

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py",line 8,in <module>
    import base64
  File "/usr/lib/python3.4/base64.py",line 9,in <module>
    import re
  File "/usr/lib/python3.4/re.py",line 336,in <module>
    import copyreg
  File "/usr/local/lib/python2.7/dist-packages/copyreg/__init__.py",line 7,in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py",line 53,in apport_excepthook
    if not enabled():
  File "/usr/lib/python3/dist-packages/apport_python_hook.py",line 24,in enabled
    import re
  File "/usr/lib/python3.4/re.py",in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.

Original exception was:
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/virtualenv.py",in <module>
    raise ImportError('This package should not be accessible on Python 3. '
ImportError: This package should not be accessible on Python 3. Either you are trying to run from the python-future src folder or your installation of python-future is corrupted.
Running virtualenv with interpreter /usr/bin/python3.4

ERROR: InvocationError: /usr/bin/python -m virtualenv --python /usr/bin/python3.4 py34 (see /home/josh/code/ezoutlet/.tox/py34/log/py34-0.log)

解决方法

您需要查看错误消息的详细信息.注意失败的命令(来自第一个摘录):

cmdargs: ['/usr/bin/python','py34']

您可以使用以下方式手动运行:

/usr/bin/python -m virtualenv --python /usr/bin/python3.4 py34

假设你看到同样的错误,你的问题是使用virtualenv而不是tox.

我查看了virtualenv帮助页面,看起来这应该有效.面对可能的错误,首先要升级Python,virtualenv或其他库.

就我而言,升级virtualenv是解决方案:

pip install --upgrade virtualenv

有趣的是,这个解决方案适用于Windows和Linux.最有可能的是,当我获得virtualenv和最新版本之间存在错误修复.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读