ubuntu18.0+python3.6+安装distribute模块出错(可能已解决)

前言

这个问题整了好久了,甚至到我写这篇博客额时候还没有解决,但是我相信应该能解决的,所以就先写下来,免得自己以后忘了写。

问题描述

由于需要运行一个开源的代码,在安装requirements时,中间应该是需要安装distribute模块,然后出现了下面额错误信息:

ERROR: Command errored out with exit status 1:
     command: /home/xhr/anaconda3/bin/python -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-h0qo0u54/distribute/setup.py'"'"'; __file__='"'"'/tmp/pip-install-h0qo0u54/distribute/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-h0qo0u54/distribute/pip-egg-info
         cwd: /tmp/pip-install-h0qo0u54/distribute/
    Complete output (15 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-h0qo0u54/distribute/setuptools/__init__.py", line 2, in <module>
        from setuptools.extension import Extension, Library
      File "/tmp/pip-install-h0qo0u54/distribute/setuptools/extension.py", line 5, in <module>
        from setuptools.dist import _get_unpatched
      File "/tmp/pip-install-h0qo0u54/distribute/setuptools/dist.py", line 7, in <module>
        from setuptools.command.install import install
      File "/tmp/pip-install-h0qo0u54/distribute/setuptools/command/__init__.py", line 8, in <module>
        from setuptools.command import install_scripts
      File "/tmp/pip-install-h0qo0u54/distribute/setuptools/command/install_scripts.py", line 3, in <module>
        from pkg_resources import Distribution, PathMetadata, ensure_directory
      File "/tmp/pip-install-h0qo0u54/distribute/pkg_resources.py", line 1518, in <module>
        register_loader_type(importlib_bootstrap.SourceFileLoader, DefaultProvider)
    AttributeError: module 'importlib._bootstrap' has no attribute 'SourceFileLoader'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

我的环境是虚拟机的ubuntu18.0,用anaconda装的python3.6。

解决方案

先是手动直接重新安装这个模块,结果显示同样的错误,网上找了一下原因,好像就是和python的版本不同,这个说法应该是对的,因为我使用python3.5安装这些依赖库的时候没有出现啥问题,但是坑爹的是这个开源的代码竟然必须要求python的版本在3.6及以上。所以就只能想法子了。。。。

没有解决方案。。。。。

可以查看其网页:distribute,发现它就支持到python3.3,所以现在的解决方案是把python版本退回到3.3,或者不使用这个模块。但是,但是我这个项目必须要3.6以上。。。。

好像是有解决方案了

在本地我没有试验过,但是在服务器上好像是解决了:
服务器端的配置是:
centos系统
python3.7
因为是要安装pyter模块,导致需要安装依赖distribute模块,所以可以直接这样解决:
在命令行中先运行:
easy_install distribute
然后
pip install pyter

总结

很难受,这个真的是无解了,唉,这些版本问题真的是让人头大,希望以后少遇到这些问题吧,整了几天还是没搞定。。。。
如果有人找到解决方案,还望不吝赐教呀!
算是解决了吧,就是不知道其他系统是否适用,都可以试一试。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 3
    评论
评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值