溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

如何在Mac系統(tǒng)中安裝virtualwrapper

發(fā)布時間:2021-03-03 17:00:48 來源:億速云 閱讀:240 作者:Leah 欄目:開發(fā)技術(shù)

這期內(nèi)容當(dāng)中小編將會給大家?guī)碛嘘P(guān)如何在Mac系統(tǒng)中安裝virtualwrapper,文章內(nèi)容豐富且以專業(yè)的角度為大家分析和敘述,閱讀完這篇文章希望大家可以有所收獲。

1. 安裝virtualwrapper

打開終端,輸入如下的命令

pip3 install virtualenv
pip3 install virtualenvwrapper

2. 在配置文件~/.bash_profile中添加代碼

# Settings for virtualenvwrapper
export WORKON_HOME=$HOME/.virtualenvs
source /usr/local/bin/virtualenvwrapper.sh

3. 讓配置生效:

source ~/.bash_profile

這時,出現(xiàn)了如下問題:

/usr/bin/python: No module named virtualenvwrapper
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=/usr/bin/python and that PATH is
set properly.

原因分析

從報錯信息中 VIRTUALENVWRAPPER_PYTHON=/usr/bin/python and that PATH is set properly. 這一句話來看,是環(huán)境指向了python2的路徑,所以我們只需要將這個環(huán)境變量修改為python3的路徑即可。

解決辦法

打開配置文件 vim ~/.bash_profile 在配置文件中添加一行代碼:

export VIRTUALENVWRAPPER_PYTHON=/usr/local/bin/python3

讓配置生效:

source ~/.bash_profile

上述就是小編為大家分享的如何在Mac系統(tǒng)中安裝virtualwrapper了,如果剛好有類似的疑惑,不妨參照上述分析進(jìn)行理解。如果想知道更多相關(guān)知識,歡迎關(guān)注億速云行業(yè)資訊頻道。

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI