pythondistutils安装_python错误:distutils.errors.DistutilsError 解决方法

服务器安装protobuf-2.6.1包时,报错如下:

[root@host73 python]# python setup.py install

Download error on https://pypi.python.org/simple/google-apputils/: [Errno -2] Name or service

not known -- Some packages may not be found!

Couldn't find index page for 'google-apputils' (maybe misspelled?)

Download error on https://pypi.python.org/simple/: [Errno -2] Name or service not known --

Some packages may not be found!

No local packages or download links found for google-apputils

Traceback (most recent call last):

File "setup.py", line 200, in

"Protocol Buffers are Google's data interchange format.",

File "/usr/lib64/python2.7/distutils/core.py", line 112, in setup

_setup_distribution = dist = klass(attrs)

File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 265, in __init__

self.fetch_build_eggs(attrs.pop('setup_requires'))

File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 289, in fetch_build_eggs

parse_requirements(requires), installer=self.fetch_build_egg

File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 618, in resolve

dist = best[req.key] = env.best_match(req, self, installer)

File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 862, in best_match

return self.obtain(req, installer) # try and download/install

File "/usr/lib/python2.7/site-packages/pkg_resources.py", line 874, in obtain

return installer(requirement)

File "/usr/lib/python2.7/site-packages/setuptools/dist.py", line 339, in fetch_build_egg

return cmd.easy_install(req)

File "/usr/lib/python2.7/site-packages/setuptools/command/easy_install.py", line 617, in

easy_install

raise DistutilsError(msg)

distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse

('google-apputils')

字面意思为:解析google-apputils,找不到合适的分布需求

解决办法:

安装google-apptuils包即可;

# yum install -y epel-release

# yum install python-pip

# pip install google-apputils

# python setup.py install

再次执行没有报错;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
引用\[1\]:Error processing line 1 of /home/chenqianyi/anaconda3/envs/pysyft/lib/python3.7/site-packages/distutils-precedence.pth: Traceback (most recent call last): File "/home/chenqianyi/anaconda3/envs/pysyft/lib/python3.7/site.py", line 168, in addpackage exec(line) File "<string>", line 1, in <module> ModuleNotFoundError: No module named '_distutils_hack'。引用\[2\]:打开error对应的文件/home/chenqianyi/anaconda3/envs/pysyft/lib/python3.7/site-packages/distutils-precedence.pth 将import os;后面加上一个enter换行 这样就可以解决这个报错问题。\[2\]引用\[3\]:项目场景: Windows环境下,使用pycharm在conda虚拟环境中执行数据预处理 问题描述: OSError: cannot load library 'D:\Programs\Anaconda3\envs\...\lib\site-packages\_soundfile_data\libsndfile64bit.dll': error 0x7e 原因分析: 使用pip指令进行插入soundfile时,所插入的仅仅是python包,若要使用soundfile则需要下载其启动文件(.exe) 解决方案: 1、在下面网址中下载对应版本: libsndfilehttp://www.mega-nerd.com/libsndfile/ windows系统安装完成之后会出现一个文档,显示windows系统收费,不用管,对于这个程序问题来说并不影响。 2、下载完成后在终端分别输入下面语句将soundfile包进行重装: pip uninstall -y cffi pycparser SoundFile//卸载soundfile pip install soundfile//安装soundfile。 问题:G:\anaconda\envs\paddlenlp\lib\site-packages\_distutils_hack\__init__.py:33: UserWarning: Setuptools is replacing distutils. 回答: 这个问题是由于缺少_distutils_hack模块导致的。你可以尝试打开对应的文件/home/chenqianyi/anaconda3/envs/pysyft/lib/python3.7/site-packages/distutils-precedence.pth,并在import os;后面加上一个enter换行,这样可以解决报错问题。\[2\]另外,关于G:\anaconda\envs\paddlenlp\lib\site-packages\_distutils_hack\__init__.py:33: UserWarning: Setuptools is replacing distutils的问题,这是一个警告信息,意味着Setuptools正在替换distutils。这个警告可以忽略,不会影响程序的正常运行。 #### 引用[.reference_title] - *1* *2* [anaconda3报错: ModuleNotFoundError: No module named ‘_distutils_hack](https://blog.csdn.net/qq_45040216/article/details/125119982)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] - *3* [解决OSError: cannot load library ‘D:\Programs\Anaconda3\envs\...\lib\site-packages\_soundfile_datal...](https://blog.csdn.net/Xiayuan_/article/details/125916323)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insertT0,239^v3^insert_chatgpt"}} ] [.reference_item] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值