按照上面的教程, 配置完镜像源之后,
sudo apt-get install aptitude
sudo aptitude install python-dev
遇到下面问题:
medlen@IdeaPad:/etc/apt$ sudo apt-get install aptitude
Reading package lists... Done
Building dependency tree
Reading state information... Done
aptitude is already the newest version (0.8.10-6ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
medlen@IdeaPad:/etc/apt$ sudo aptitude install python-dev
No candidate version found for python-dev
Unable to apply some actions, aborting
说是没有找到候选的版本;
参考: https://blog.csdn.net/Lyncai/article/details/80934683
这个问题的原因是ubuntu的/etc/apt/source.list中的源比较旧了,需要更新一下
于是运行:
sudo apt-get -y update
然后遇到了新的问题:
W: GPG error: http://us.archive.ubuntu.com/ubuntu precise-updates InRelease: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 40976EAF437D05B5
E: The repository 'http://us.archive.ubuntu.com/ubuntu precise-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
参考:https://chrisjean.com/fix-apt-get-update-the-following-signatures-couldnt-be-verified-because-the-public-key-is-not-available/
运行下面命令:
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 40976EAF437D05B5
之后安装python-dev:
sudo apt-get install python-dev
显示缺少依赖包
The following packages have unmet dependencies:
python-dev : Depends: python (= 2.7.5-5ubuntu3) but it is not going to be installed
Depends: libpython-dev (= 2.7.5-5ubuntu3) but it is not going to be installed
Depends: python2.7-dev (>= 2.7.5-1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
更新软件源:
sudo apt-get update
又一个问题:
W: GPG error: http://us.archive.ubuntu.com/ubuntu precise-updates InRelease: The following signatures were invalid: 630239CC130E1A7FD81A27B140976EAF437D05B5
E: The repository 'http://us.archive.ubuntu.com/ubuntu precise-updates InRelease' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
签名无效。。。
从报错上看, 是因为访问这个路径出的问题:http://us.archive.ubuntu.com/ubuntu,这个是原始的源数据找到后删除即可;
我的这个是在
/etc/apt/sources.list.d/
路径下的precise-updates.list文件中,这个是因为之前执行过
echo "deb http://us.archive.ubuntu.com/ubuntu/ precise-updates main restricted" | sudo tee -a /etc/apt/sources.list.d/precise-updates.list
这个命令。
也就是文章开头推荐的链接里面, 第三个方法。
最后执行
sudo aptitude install python-dev
成功!