linux报错pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: ‘0.23ubuntu1’
Posted 米码收割机
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了linux报错pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: ‘0.23ubuntu1’相关的知识,希望对你有一定的参考价值。
Linux使用python3.8运行脚本时,出现如下报错:
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: ‘0.23ubuntu1’ (package: distro-info)
报错提示
Traceback (most recent call last):
File “CaptureHDRPointCloud.py”, line 5, in
from XXX import Device
File “/home/XXX_XXX_sdk/.local/lib/python3.8/site-packages/XXX/init.py”, line 3, in
version = XXX._version.get_version(name) # pylint: disable=protected-access
File “/home/XXX_XXX_sdk/.local/lib/python3.8/site-packages/XXX/_version.py”, line 16, in get_version
return get_distribution(module_name).version
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 514, in get_distribution
dist = get_provider(dist)
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 386, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 956, in require
needed = self.resolve(parse_requirements(requirements))
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 815, in resolve
dist = self._resolve_dist(
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 844, in _resolve_dist
env = Environment(self.entries)
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 1044, in init
self.scan(search_path)
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 1077, in scan
self.add(dist)
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 1096, in add
dists.sort(key=operator.attrgetter(‘hashcmp’), reverse=True)
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 2631, in hashcmp
self.parsed_version,
File “/usr/local/lib/python3.8/dist-packages/pkg_resources/init.py”, line 2685, in parsed_version
raise packaging.version.InvalidVersion(f"str(ex) info") from None
pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: ‘0.23ubuntu1’ (package: distro-info)
解决方案
此报错是由于setuptools
版本过高导致的,原则上python3.8的允许的setuptools版本<66.0.0
。
需要卸载原先的setuptools:
pip3.8 uninstall setuptools
再执行:
pip3.8 install setuptools==49.2.1
再运行您的程序就可以解决了。
如果对您有帮助,点赞、关注、收藏 !
(关注“测试开发自动化” 弓中皓,获取更多学习内容)
Linux报错
Linux报错
-------------------
no medium found on /dev/sr0
解决办法
https://blog.csdn.net/u013395878/article/details/49662729
vsftpd登录时提示“vsftpd 500 OOPS: chroot”的问题
当我们限定了用户不能跳出其主目录之后,使用该用户登录FTP时往往会遇到这个错误:
解决办法:
是selinux的问题,它有一个叫做”Allowftptoread/writeintheuserhomedirect
vsftpd增强了安全检查,如果用户被限定在了其主目录下,则该用户的主目录不能再具有写权限了!如果检查发现还有写权限,就会报该错误。 要修复这个错误,可以用命令chmod a-w /home/user去除用户主目录的写权限,注意把目录替换成你自己的。或者你可以在vsftpd的配置文件中增加下列两项中的一项:allow_writeable_chroot=YES
---------------------
service vsftpd start 提示:Redirecting to /bin/systemctl start vsftpd.service
1、原因:估计是使用的是Centos7或者 Fedora高版本。启用服务变化了。
2、解决方法:执行命令使用:#/bin/systemctl start vsftpd.service。
-------------------
--------------------------------------------
以上是关于linux报错pkg_resources.extern.packaging.version.InvalidVersion: Invalid version: ‘0.23ubuntu1’的主要内容,如果未能解决你的问题,请参考以下文章