嗨,我尝试修复这个问题很长时间了,但没有成功。当我打开 zsh 终端时,我收到此错误:(终端正在运行,但出现错误)
Welcome to the world of tomorrow!
virtualenvwrapper_run_hook:12: permission denied:
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON= and that PATH is
set properly.
我尝试了一些方法,但是……不知道如何解决。不知怎么的,在搜索过程中,我发现我应该在这里发布以下输出:
→ sudo dpkg --configure -a
Setting up python-pip (1.0-1build1) ...
/var/lib/dpkg/info/python-pip.postinst: 6: /var/lib/dpkg/info/python-pip.postinst: pycompile: not found
dpkg: error processing python-pip (--configure):
subprocess installed post-installation script returned error exit status 127
Setting up libc-dev-bin (2.15-0ubuntu10.5) ...
Setting up gnome-control-center-data (1:3.4.2-0ubuntu0.13) ...
Setting up linux-libc-dev (3.2.0-56.86) ...
Setting up python-virtualenv (1.7.1.2-1) ...
/var/lib/dpkg/info/python-virtualenv.postinst: 6: /var/lib/dpkg/info/python-virtualenv.postinst: pycompile: not found
dpkg: error processing python-virtualenv (--configure):
subprocess installed post-installation script returned error exit status 127
Setting up libglib2.0-0 (2.32.4-0ubuntu1) ...
Setting up libglib2.0-0:i386 (2.32.4-0ubuntu1) ...
Setting up gimp (2.6.12-1ubuntu1.2) ...
/var/lib/dpkg/info/gimp.postinst: 11: /var/lib/dpkg/info/gimp.postinst: pycompile: not found
dpkg: error processing gimp (--configure):
subprocess installed post-installation script returned error exit status 127
Setting up libpolkit-gobject-1-0 (0.104-1ubuntu1.1) ...
Setting up libgnome-control-center1 (1:3.4.2-0ubuntu0.13) ...
Setting up libnm-util2 (0.9.4.0-0ubuntu4.3) ...
Setting up libc6-dev (2.15-0ubuntu10.5) ...
Setting up libpulse-mainloop-glib0 (1:1.1-0ubuntu15.4) ...
dpkg: dependency problems prevent configuration of virtualenvwrapper:
virtualenvwrapper depends on python-virtualenv; however:
Package python-virtualenv is not configured yet.
dpkg: error processing virtualenvwrapper (--configure):
dependency problems - leaving unconfigured
Setting up libpolkit-agent-1-0 (0.104-1ubuntu1.1) ...
Setting up libupower-glib1 (0.9.15-3git1ubuntu0.1) ...
Setting up libaccountsservice0 (0.6.15-2ubuntu9.6.1) ...
Setting up libpolkit-backend-1-0 (0.104-1ubuntu1.1) ...
Setting up libglib2.0-bin (2.32.4-0ubuntu1) ...
Setting up libnm-glib4 (0.9.4.0-0ubuntu4.3) ...
Setting up policykit-1 (0.104-1ubuntu1.1) ...
Setting up gnome-settings-daemon (3.4.2-0ubuntu0.6.4) ...
Setting up accountsservice (0.6.15-2ubuntu9.6.1) ...
dpkg: error processing ubuntu-system-service (--configure):
Package is in a very bad inconsistent state - you should
reinstall it before attempting configuration.
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
Errors were encountered while processing:
python-pip
python-virtualenv
gimp
virtualenvwrapper
ubuntu-system-service
还:
→ python --version
zsh: command not found: python
我的 ~/.zshrc 的一部分
# python virtual env wrapper
if [ -f ~/.local/bin/virtualenvwrapper.sh ]; then
export WORKON_HOME=~/.virtualenvs
source ~/.local/bin/virtualenvwrapper.sh
plugins=("${plugins[@]}" virtualenvwrapper)
fi
# pythonbrew
[[ -s ~/.pythonbrew/etc/bashrc ]] && source ~/.pythonbrew/etc/bashrc
操作系统部分 zsh -xv
#
# Invoke the initialization functions
#
virtualenvwrapper_initialize
+/home/trki/.local/bin/virtualenvwrapper.sh:1179> virtualenvwrapper_initialize
+virtualenvwrapper_initialize:1> virtualenvwrapper_derive_workon_home
+virtualenvwrapper_derive_workon_home:1> typeset 'workon_home_dir=/home/trki/.virtualenvs'
+virtualenvwrapper_derive_workon_home:5> [ /home/trki/.virtualenvs '=' '' ']'
+virtualenvwrapper_derive_workon_home:12> echo /home/trki/.virtualenvs
+virtualenvwrapper_derive_workon_home:12> unset GREP_OPTIONS
+virtualenvwrapper_derive_workon_home:12> grep '^[^/~]'
+virtualenvwrapper_derive_workon_home:21> echo /home/trki/.virtualenvs
+virtualenvwrapper_derive_workon_home:21> unset GREP_OPTIONS
+virtualenvwrapper_derive_workon_home:21> egrep '([\$~]|//)'
+virtualenvwrapper_derive_workon_home:30> echo /home/trki/.virtualenvs
+virtualenvwrapper_derive_workon_home:31> return 0
+virtualenvwrapper_initialize:1> export 'WORKON_HOME=/home/trki/.virtualenvs'
+virtualenvwrapper_initialize:3> virtualenvwrapper_verify_workon_home -q
+virtualenvwrapper_verify_workon_home:1> RC=0
+virtualenvwrapper_verify_workon_home:2> [ ! -d /home/trki/.virtualenvs/ ']'
+virtualenvwrapper_verify_workon_home:11> return 0
+virtualenvwrapper_initialize:6> [ /home/trki/.virtualenvs '=' '' ']'
+virtualenvwrapper_initialize:11> virtualenvwrapper_run_hook initialize
+virtualenvwrapper_run_hook:1> typeset hook_script
+virtualenvwrapper_run_hook:2> typeset result
+virtualenvwrapper_run_hook:4> hook_script=+virtualenvwrapper_run_hook:4> virtualenvwrapper_tempfile initialize-hook
+virtualenvwrapper_tempfile:2> typeset 'suffix=initialize-hook'
+virtualenvwrapper_tempfile:3> typeset file
+virtualenvwrapper_tempfile:5> file=+virtualenvwrapper_tempfile:5> virtualenvwrapper_mktemp -t virtualenvwrapper-initialize-hook-XXXXXXXXXX
+virtualenvwrapper_mktemp:1> mktemp -t virtualenvwrapper-initialize-hook-XXXXXXXXXX
+virtualenvwrapper_tempfile:5> file=/tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7
+virtualenvwrapper_tempfile:6> [ 0 -ne 0 ']'
+virtualenvwrapper_tempfile:6> [ -z /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7 ']'
+virtualenvwrapper_tempfile:6> [ ! -f /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7 ']'
+virtualenvwrapper_tempfile:11> echo /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7
+virtualenvwrapper_tempfile:12> return 0
+virtualenvwrapper_run_hook:4> hook_script=/tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7
+virtualenvwrapper_run_hook:11> cd /home/trki/.virtualenvs
+cd:1> [[ x/home/trki/.virtualenvs == x... ]]
+cd:3> [[ x/home/trki/.virtualenvs == x.... ]]
+cd:5> [[ x/home/trki/.virtualenvs == x..... ]]
+cd:7> [[ x/home/trki/.virtualenvs == x...... ]]
+cd:9> [ -d /home/trki/.autoenv ']'
+cd:13> cd /home/trki/.virtualenvs
+virtualenvwrapper_run_hook:12> '' -m virtualenvwrapper.hook_loader --script /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7 initialize
virtualenvwrapper_run_hook:12: permission denied:
+virtualenvwrapper_run_hook:15> result=126
+virtualenvwrapper_run_hook:17> [ 126 -eq 0 ']'
+virtualenvwrapper_run_hook:27> [ initialize '=' initialize ']'
+virtualenvwrapper_run_hook:29> cat -
virtualenvwrapper.sh: There was a problem running the initialization hooks.
If Python could not import the module virtualenvwrapper.hook_loader,
check that virtualenv has been installed for
VIRTUALENVWRAPPER_PYTHON= and that PATH is
set properly.
+virtualenvwrapper_run_hook:38> rm -f /tmp/virtualenvwrapper-initialize-hook-OhY86PXmo7
+virtualenvwrapper_run_hook:39> return 126
+virtualenvwrapper_initialize:13> virtualenvwrapper_setup_tab_completion
+virtualenvwrapper_setup_tab_completion:1> [ -n '' ']'
+virtualenvwrapper_setup_tab_completion:20> [ -n 4.3.17 ']'
+virtualenvwrapper_setup_tab_completion:30> compctl -K _virtualenvs workon rmvirtualenv cpvirtualenv showvirtualenv
+virtualenvwrapper_setup_tab_completion:31> compctl -K _cdvirtualenv_complete cdvirtualenv
+virtualenvwrapper_setup_tab_completion:32> compctl -K _cdsitepackages_complete cdsitepackages
+virtualenvwrapper_initialize:15> return 0
+/home/trki/.zshrc:17> plugins=( git python django symfony2 zsh-syntax-highlighting composer history-substring-search virtualenvwrapper )
# pythonbrew
[[ -s ~/.pythonbrew/etc/bashrc ]] && source ~/.pythonbrew/etc/bashrc
+/home/trki/.zshrc:21> [[ -s /home/trki/.pythonbrew/etc/bashrc ]]
另外,当我尝试打开 ubuntu 软件中心时,什么也没有发生。不知道现在该怎么办。
答案1
免责声明:我对您安装的 Python 一无所知virtualenv
,但似乎您的软件包处于不一致的状态。可能很多问题都是因为您的 shell 启动文件中出现故障,并且您的环境不成熟。所以这是一个胡乱猜测,你应该根据virtualenv
你所拥有的东西进行检查。
免责声明:如果您安装了强制安装的东西(您或某些脚本),这可能会破坏您的系统。
我将尝试执行以下操作:
1)尝试看看它是否可以自动修复:
sudo apt-get install -f
2)如果失败,请尝试查看您是否“保留”了包裹:
apt-mark showhold
3)如果有的话,请按如下方式取消保留:
sudo apt-mark unhold <package name>
然后重复步骤1。
之后,你可能要做的最好的事情就是删除所有导致问题的软件包
sudo apt-get remove <package>
或者甚至(你已经尝试过配置文件)
sudo apt-get purge <package>
然后使用 重新安装它们sudo apt-get install
。我至少会对出现错误的软件包执行此操作:
python-pip python-virtualenv gimp virtualenvwrapper ubuntu-system-service
并且可能zsh
也是如此 --- 可能您还必须删除/重命名.zshrc
、.zlogin
、.zshenv
文件(如果某些安装脚本已修改它们,则重新安装 zsh 不会更改主目录中的文件)。希望这能有所帮助...