Ubuntu
ssh 登錄時找不到命令“+ virtualenvwrapper 錯誤(Ubuntu 18.04 x64)
當使用 ssh 密鑰登錄我的 VPS 時,我得到了這個:
Command '' not found, but can be installed with: sudo apt install libpam-mount ... sudo apt install nmh virtualenvwrapper.sh: There was a problem running the initialization hooks. If Python could not import the module virtualenvwrapper.hook_loader, check that virtualenvwrapper has been installed for VIRTUALENVWRAPPER_PYTHON= and that PATH is set properly.
這是我的
.bashrc
變數:export WORKON_HOME=~/Env source /usr/local/bin/virtualenvwrapper.sh export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3
我試過的
- 採購
.bashrc
,~/.profile
和/usr/local/bin/virtualenvwrapper.sh
(沒有錯誤)- 升級
virtualenvwrapper
(pip3 --upgrade
最新)此外,我的 virtualenv 工作完美。
在腳本的第47-51 行,
virtualenvwrapper.sh
它首先檢查是否VIRTUALENVWRAPPER_PYTHON
設置了環境變數,如果沒有,則在第 50 行設置它:VIRTUALENVWRAPPER_PYTHON="$(command \which python)"
問題是較新版本的 Ubuntu(18.04+)不再
python
安裝二進製文件,只有python3
. 更改python
為腳本python3
的第 50 行,一切就緒;)否則,在 中
.bashrc
,您需要先設置VIRTUALENVWRAPPER_PYTHON
,然後再source
設置腳本:VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 source /usr/local/bin/virtualenvwrapper.sh
簡而言之,
virtualenvwrapper.sh
是 Python 包的一部分。我在新的 Ubuntu 18.04 安裝中遇到了這個問題。我在一台舊機器上檢查了我的日誌,發現以下內容:
sudo -H pip3 install virtualenvwrapper sudo -H pip install virtualenvwrapper
當我在新機器上執行它們時,錯誤消息消失了。