久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

為什么 conda init 錯誤地更新了我的 .bash_profile?

Why is conda init updating my .bash_profile incorrectly?(為什么 conda init 錯誤地更新了我的 .bash_profile?)
本文介紹了為什么 conda init 錯誤地更新了我的 .bash_profile?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

按照 這些步驟 并安裝 conda 后,似乎 conda init 更新了我的 .bash_profile 由于某種原因不正確.它在運行 .bashrc 之后添加它的內(nèi)容,因此當(dāng) bash 啟動時,由于某種原因,我的所有 conda 內(nèi)容都沒有正確啟動.我最終不得不手動將 .bash_profile 更改為如下所示:

After following these steps and installing conda it seems that conda init updates my .bash_profile incorrectly for some reason. It adds it's content AFTER running .bashrc and thus when bash gets started all my conda stuff does not get initiated correctly for some reason. I ended up having to change the .bash_profile manually to look like this:

(automl) brandBrandoParetoopareto~ $ cat .bash_profile
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/brandBrandoParetoopareto/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/brandBrandoParetoopareto/anaconda3/etc/profile.d/conda.sh" ]; then
        . "/Users/brandBrandoParetoopareto/anaconda3/etc/profile.d/conda.sh"
    else
        export PATH="/Users/brandBrandoParetoopareto/anaconda3/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

我安裝它的方式是使用我認為的官方安裝:

The way I installed it was using what I thought was the official installation:

sh Anaconda3-2020.02-MacOSX-x86_64.sh

但這似乎會導(dǎo)致問題(例如,conda init bash 沒有將內(nèi)容添加到 .bash_profile 的正確位置.圖形/dmg 安裝程序甚至將內(nèi)容安裝在~/opt 出于某種原因).我概述了對我有用的 hacky 解決方案here,但我認為這不是正確的做事方式.

but that seems to be causing issues (e.g. conda init bash not adding the stuff in the right place to .bash_profile. The graphical/dmg installer even installs things at ~/opt for some reason). I outlined the hacky solution that worked for me here but I assume that is not the right way to be doing things.

是什么導(dǎo)致了我的問題,我該如何解決?

What is causing my problems and how do I fix it?

推薦答案

正如 chepner 的評論所說,正如我自己最終發(fā)現(xiàn)的那樣,conda init 不能開箱即用某些原因(例如,如果它修改了 .bash_profile 很明顯用戶將在某處運行他們的 .bashrc 文件,因此它應(yīng)該在此之前正確添加它的內(nèi)容,或者至少在恕我直言).無論如何,這是一個工作文件的例子:

As the comment by chepner says as I discovered on my own eventually is that conda init doesn't work out of the box for some reason (e.g. if it modifies .bash_profile it's obvious the user will run their .bashrc file somewhere there so it should add it's contents correctly before that, or at least in imho). Anyway this is an example of a working file:

(automl) brandBrandoParetoopareto~/automl-meta-learning $ cat ~/.bash_profile 
echo ----Running .bash_profile

conda -V
python -V
echo $PATH
echo $PATH | tr ":" "
"

# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
__conda_setup="$('/Users/brandBrandoParetoopareto/anaconda3/envs/automl/bin/conda' 'shell.bash' 'hook' 2> /dev/null)"
if [ $? -eq 0 ]; then
    eval "$__conda_setup"
else
    if [ -f "/Users/brandBrandoParetoopareto/anaconda3/envs/automl/etc/profile.d/conda.sh" ]; then
        . "/Users/brandBrandoParetoopareto/anaconda3/envs/automl/etc/profile.d/conda.sh"
    else
        export PATH="/Users/brandBrandoParetoopareto/anaconda3/envs/automl/bin:$PATH"
    fi
fi
unset __conda_setup
# <<< conda initialize <<<

echo ----Completed running .bash_profile

if [ -f ~/.bashrc ]; then
   source ~/.bashrc
fi

在我手動更改后.

我沒想到我需要自己修改這些東西.也許我不應(yīng)該信任命令/安裝程序等,而是更頻繁地查看他們終端的輸出.

I would have not guessed I needed to modify these things myself. Perhaps I should not trust commands/installers etc and see what the output to their terminal is more often.

另外,如果你像我一樣在 vscode 中使用集成終端,情況會更糟.為此,請閱讀此內(nèi)容以避免錯誤/奇怪的行為:https:///code.visualstudio.com/updates/v1_36#_launch-terminals-with-clean-environments

Also, things are worse if your using the integrated terminal in vscode like I was. For that read this to avoid errors/strange behaviours: https://code.visualstudio.com/updates/v1_36#_launch-terminals-with-clean-environments

在干凈的環(huán)境中啟動終端 VS 中的集成終端代碼的行為總是與普通終端略有不同,特別是在 Linux 和 macOS 上.原因是環(huán)境總是繼承自 VS Code 的窗口(實例)和 VS代碼/電子相關(guān)的環(huán)境變量被刪除,而普通終端通常會從 Dock/Start 菜單啟動并使用系統(tǒng)環(huán)境.這可能會導(dǎo)致某些問題場景,例如 Python 虛擬環(huán)境被破壞,因為他們?nèi)绾问褂?$PATH 變量.

Launch terminals with clean environments The Integrated Terminal in VS Code has always acted a little differently to normal terminals, particularly on Linux and macOS. The reason is that the environment was always inherited from VS Code's window (instance) and VS Code/Electron-related environment variables were removed, whereas a normal terminal would typically be launched from the Dock/Start menu and use the system environment. This could cause issues in certain scenarios, for example Python virtual environments were broken because of how they use the $PATH variable.

有一個新的預(yù)覽選項,terminal.integrated.inheritEnv,它當(dāng) false 導(dǎo)致終端不使用 VS Code 的環(huán)境.

There's a new preview option, terminal.integrated.inheritEnv, that when false causes the terminal to not use VS Code's environment.

相反,根據(jù)平臺,它將執(zhí)行以下操作:

Instead, depending on the platform, it will do the following:

Linux:獲取和使用VS的父進程的環(huán)境代碼的主要過程".macOS:拉一把重要的環(huán)境當(dāng)前環(huán)境中的變量,僅包含它們.最終我們希望 macOS 的行為與 Linux 相同,但目前是獲取環(huán)境的問題.窗戶:目前此設(shè)置不影響 Windows.主要可見結(jié)果將 inheritEnv 設(shè)置為 false 是 $SHLVL(shell 級別)現(xiàn)在應(yīng)該是1 和 $PATH 不應(yīng)包含重復(fù)的路徑,前提是您的啟動腳本不會有意包含它們.

Linux: Fetch and use the environment of the parent process of VS Code's "main process". macOS: Pull a handful of important environment variables off the current environment and only include them. Eventually we would like macOS to behave the same as Linux but there are currently issues with fetching environments. Windows: Currently this setting does not affect Windows. The main visible result of setting inheritEnv to false is that $SHLVL (shell level) should now be 1 and $PATH should not include duplicate paths, provided your launch scripts don't intentionally include them.

terminal.integrated.inheritEnv 的默認值為 true,即以前的行為,但我們可能會將值切換為 false未來.

The default value for terminal.integrated.inheritEnv is true, which is the previous behavior, but we will probably switch the value to false in the future.

完全關(guān)閉和打開 vscode 似乎也很有幫助.

希望這將節(jié)省人們更改 bash 文件以及重新安裝和卸載一堆東西的日子.

Hopefully, this will save people's days of changing bash files around and re-installing and uninstalling a bunch of things.

另一個有用的提示是轉(zhuǎn)到 vscode 左上角的 code 點擊它然后轉(zhuǎn)到首選項然后設(shè)置.然后您可以通過取消單擊/選擇將 terminal.integrated.inheritEnv 更改為 false.

Another helpful tip is to go the top left of vscode where it says code click it then go to preferences and then settings. Then you can change the terminal.integrated.inheritEnv to false by unclicking/selecting it.

這篇關(guān)于為什么 conda init 錯誤地更新了我的 .bash_profile?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請聯(lián)系我們刪除處理,感謝您的支持!

相關(guān)文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時出現(xiàn)問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節(jié)點)
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應(yīng)并將元素值存儲在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對象)
主站蜘蛛池模板: 99福利 | 成人久久18免费 | 视频一区二区三区中文字幕 | 国产免费一级一级 | 亚洲免费人成在线视频观看 | 在线观看av不卡 | 国产一区精品在线 | 国产在线精品一区 | 国内精品成人 | 亚洲综合视频 | 成人综合一区二区 | 中文字幕欧美一区 | 精品中文字幕久久 | 国产一级一级国产 | 99免费| 男女视频在线免费观看 | 狠狠干网站 | 国产一区二区 | 国产精品视频一二三 | 激情 婷婷| 91精品国产一区二区三区香蕉 | 久久久婷| 亚洲伊人久久综合 | 91亚洲国产 | 日韩色综合 | 久久久国产精品一区 | 成人av免费在线观看 | 欧美日韩视频一区二区 | 免费国产一区二区 | 久久久久无码国产精品一区 | av免费观看在线 | 国产一区二区在线视频 | 国产精华一区 | 国产精品日韩欧美一区二区三区 | 91久久国产综合久久 | 一级黄a | 日韩精品在线看 | 国产一级一级毛片 | 欧美激情久久久 | 久久久久久久久久久高潮一区二区 | 精品网站999 |