学习笔记113—ubuntu 16.04常见错误

1、ubuntu常见错误--Could not get lock /var/lib/dpkg/lock解决

https://www.cnblogs.com/ace-wu/p/6623150.html

ubuntu常见错误--Could not get lock /var/lib/dpkg/lock解决

通过终端安装程序sudo apt-get install xxx时出错:

E: Could not get lock /var/lib/dpkg/lock - open (11: Resource temporarily unavailable)
E: Unable to lock the administration directory (/var/lib/dpkg/), is another process using it

出现这个问题可能是有另外一个程序正在运行,导致资源被锁不可用。而导致资源被锁的原因可能是上次运行安装或更新时没有正常完成,进而出现此状况,解决的办法其实很简单:

在终端中敲入以下两句

hlp@hlp-Lenovo-G405:~$ sudo rm /var/lib/dpkg/lock
hlp@hlp-Lenovo-G405:~$ sudo dpkg --configure -a
hlp@hlp-Lenovo-G405:~$ sudo apt update
hlp@hlp-Lenovo-G405:~$ sudo apt list --upgradable

2、Python ImportError: No module named wx 解决方案
安装wxPython,
方法一:使用命令行(三个命令,任使用一种即可):
1) pip install -U wxPython
2)gk3: pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 \ wxPython
3)gk2: pip install -U -f https://extras.wxpython.org/wxPython4/extras/linux/gtk2/ubuntu-16.04 \ wxPython
方法二:使用命令行(三个命令一起使用):
$ sudo apt-get install python3-pip
 
$ sudo apt-get install build-essential
 
$ sudo pip3 install --upgrade pip
 
$ sudo pip3 install wxpython
 
3、解决 ImportError: No module named _internal

   在运行 pip 时遇到如下错误:

Traceback (most recent call last):
  File "/usr/local/bin/pip", line7, in <module>
      from pip._internal import main
ImportError: No module named _internal

  原因:后续又安装了pip,导致版本冲突。

  解决方法:sudo apt remove python-pip

4、解决 /mnt/temp is write-protected, mounting read-only

    mount -o remount,rw /mnt/temp /mnt/temp

5、解决下载软件慢

   点击“设置” ---> 'Sofware& Updates' ---> 'download from' , 修改成国内的服务器

6、安装权限问题: RROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied: '/usr/local/lib/python3.5/dist-packages/pycrypto-2.6.1.dist-info'
     Consider using the `--user` option or check the permissions.      在命令后面加 ‘--user’ :  pip install ecdsa --user

7、easy_install 安装软件报错:Unknown distribution option: 'python_requires'

 

pip install --upgrade pip
pip install --upgrade setuptools

 

8、删除锁定文件

  锁定的文件会阻止 Linux 系统中某些文件或者数据的访问,这个概念也存在于 Windows 或者其他的操作系统中。

 一旦你运行了 apt-get 或者 apt 命令,锁定文件将会创建于 /var/lib/apt/lists//var/lib/dpkg//var/cache/apt/archives/ 中。

这有助于运行中的 apt-get 或者 apt 进程能够避免被其它需要使用相同文件的用户或者系统进程所打断。当该进程执行完毕后,锁定文件将会删除。

 所以:

 1:移除对应目录下的锁文件:sudo rm /var/lib/dpkg/lock

 2:强制重新配置软件包:sudo dpkg --configure -a

 3:更新软件包源文件:sudo apt update

  4:列出软件包源文件:apt list --upgradable


9、Setup script exited with error: command 'x86_64-linux-gnu-gcc' failed with exit status 1 解决办法

今天在Ubuntu16.04 上安装python包的时候,出现了这个坑爹的问题:

解决办法,内容总结如下

情况是这样,报错是因为没有把依赖包安装全,报错情况如下图:

解决办法,先安装一些必须的依赖:
sudo apt-get install build-essential python3-dev libssl-dev libffi-dev libxml2 libxml2-dev libxslt1-dev zlib1g-dev
一个命令,安装完毕后,在重新安装python包!OK,搞定!
出错原因是没有安装依赖库 
原文链接:https://blog.csdn.net/u012798683/article/details/88403066

 10问题:dpkg: error: dpkg frontend is locked by another process

sudo rm /var/lib/dpkg/lock-frontend
sudo apt-get install -f

 11、 问题详细提示如下:

E: Could not get lock /var/lib/dpkg/lock-frontend - open (11: Resource temporarly unavailable)

E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is an other process using it?

解决办法:

  2.1 首先查看是否有apt-get这个程序在运行

  ps aux|grep apt-get

  2.2 如果发现存在这样的程序在运行那么就kill掉,否则执行2.3

  2.3 直接删除锁文件

  sudo rm /var/lib/dpkg/lock-frontend

  sudo rm /var/lib/dpkg/lock

 

 

 

 

posted @ 2019-11-17 20:07  何弈  阅读(528)  评论(0编辑  收藏  举报
你好