ubuntu22.04环境中安装pylint

ubuntu22.04环境中安装pylint

  • [sudo apt-get install python3-pip](#sudo apt-get install python3-pip)
  • [sudo aptitude install python3-pip](#sudo aptitude install python3-pip)
  • [sudo pip install pylint](#sudo pip install pylint)

sudo apt-get install python3-pip

在安装pylint的时候,需要使用pip命令,在ubuntu22.04环境中命令如下:

$ sudo apt-get install python3-pip        
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-setuptools : Depends: python3-pkg-resources (= 59.6.0-1.2) but 59.6.0-1.2ubuntu0.22.04.1 is to be installed
E: Unable to correct problems, you have held broken packages.

这里提示报错导致安装不能继续,尝试了很多方法去解决这个问题,其实这个问题可以方便地通过aptitude命令来进行解决。

sudo aptitude install python3-pip

$ sudo aptitude install python3-pip
The following NEW packages will be installed:
  python3-pip{b} python3-wheel{a} 
0 packages upgraded, 2 newly installed, 0 to remove and 0 not upgraded.
Need to get 1,337 kB of archives. After unpacking 7,176 kB will be used.
The following packages have unmet dependencies:
 python3-pip : Depends: python3-setuptools but it is not installable
The following actions will resolve these dependencies:

     Keep the following packages at their current version:
1)     python3-pip [Not Installed]                        



Accept this solution? [Y/n/q/?] n

注意这里一定要选择n,接着系统就会给出降版本的建议

The following actions will resolve these dependencies:

     Install the following packages:                                                
1)     python3-setuptools [59.6.0-1.2 (jammy)]                                      

     Downgrade the following packages:                                              
2)     python3-pkg-resources [59.6.0-1.2ubuntu0.22.04.1 (now) -> 59.6.0-1.2 (jammy)]


Accept this solution? [Y/n/q/?] Y

这里要选择Y,接着就可以正常安装。安装完毕使用whereis pip命令检查也符合预期。

sudo pip install pylint

使用命令sudo pip install pylint进行安装,确认安装状态(不同时期版本号会有所差异)。

$ pylint --version
pylint 3.1.0
astroid 3.1.0
Python 3.10.12 (main, Nov 20 2023, 15:14:05) [GCC 11.4.0]
相关推荐
geovindu1 分钟前
python: SQLAlchemy (ORM) Simple example using mysql in Ubuntu 24.04
python·mysql·ubuntu
nuclear20113 分钟前
Python 将PPT幻灯片和形状转换为多种图片格式(JPG, PNG, BMP, SVG, TIFF)
python·ppt转图片·ppt转png·ppt转jpg·ppt转svg·ppt转tiff·ppt转bmp
大胖丫14 分钟前
vue 学习-vite api.js
开发语言·前端·javascript
遇见很ok15 分钟前
js中 ES6 新特性详解
开发语言·javascript·es6
没有晚不了安23 分钟前
1.13作业
开发语言·python
布谷歌27 分钟前
Oops! 更改field的数据类型,影响到rabbitmq消费了...(有关于Java序列化)
java·开发语言·分布式·rabbitmq·java-rabbitmq
被程序耽误的胡先生33 分钟前
java中 kafka简单应用
java·开发语言·kafka
刀客12333 分钟前
python小项目编程-中级(1、图像处理)
开发语言·图像处理·python
卷卷的小趴菜学编程38 分钟前
c++之多态
c语言·开发语言·c++·面试·visual studio code
信阳农夫1 小时前
python 3.6.8支持的Django版本是多少?
python·django·sqlite