最近apt-get upgrade
在 16.04 上,我总是收到来自安装信息:
$ sudo apt-get install -f
Reading package lists... Done
Building dependency tree
Reading state information... Done
0 to upgrade, 0 to newly install, 0 to remove and 1 not to upgrade.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up install-info (6.1.0.dfsg.1-5) ...
/usr/sbin/update-info-dir: 23: /etc/environment: /usr/local/lib/python2.7/dist-packages: Permission denied
dpkg: error processing package install-info (--configure):
subprocess installed post-installation script returned error exit status 126
Errors were encountered while processing:
install-info
E: Sub-process /usr/bin/dpkg returned an error code (1)
$ ls -ld /etc/environment /usr/local/lib/python2.7/dist-packages
-rw-r--r-- 1 root root 1181 Sep 14 21:08 /etc/environment
drwxrwsr-x 331 root root 20480 Sep 14 15:15 /usr/local/lib/python2.7/dist-packages
编辑:本月我更改[添加]的一行/etc/environment
是:
PYTHONPATH=/usr/local/lib/python2.7/site-packages;/usr/local/lib/python2.7/dist-packages
答案1
PATH 变量中的项目应以冒号分隔
$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/telegram:/opt/lks-indicator:/snap/bin
如果你使用分号,bash 会将分号后面的内容解释为命令
$ export PATH=$PATH;/home/zanna/playground
bash: /home/zanna/playground: Is a directory
更清晰的说明:我添加了一个仅包含以下内容的脚本uname -r
:
$ export PATH=$PATH;/home/zanna/playground/uname
4.4.0-36-generic
要解决您的问题,请更改此行/etc/environment
PYTHONPATH=/usr/local/lib/python2.7/site-packages;/usr/local/lib/python2.7/dist-packages
到
PYTHONPATH=/usr/local/lib/python2.7/site-packages:/usr/local/lib/python2.7/dist-packages
然后退出并重新登录:)