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

在 Windows 上使用帶有 cygwin 的 anaconda 環境

Using anaconda environments with cygwin on windows(在 Windows 上使用帶有 cygwin 的 anaconda 環境)
本文介紹了在 Windows 上使用帶有 cygwin 的 anaconda 環境的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

嘗試通過 Windows NT 上的 cygwin 界面使用 anaconda 設置環境,但失敗了.

Trying to set up environments with anaconda through the cygwin interface on Windows NT, and failing.

創建環境(conda create -n test_env)工作正常.但是 activate test_env 失敗.

Creating environments (conda create -n test_env) works fine. But activate test_env fails.

我嘗試用以下方法破解它:

I tried hacking it with:

export PATH=/cygdrive/c/users/nick/anaconda3/envs/test:$PATH

這修正了一些行為(which python 指向正確的 python).但是如果我然后執行conda install"命令,它會安裝到根 anaconda 目錄中,而不是環境中.也許導出是 bash 會話的本地導出,并且 conda 調用了不同版本的 PATH?有沒有辦法讓PATH全局修改?

This fixes some behavior (which python points to the right python). But if I then do a "conda install" command, it installs into the root anaconda directory, not the environment. Perhaps the export is local to the bash session, and conda calls a different version of PATH? There a way to make the modification of PATH global?

推薦答案

在與這個問題搏斗了一段時間后,我想我已經實現了一個合理可行的方法,將 Anaconda 的 python(和相關環境)集成到 Cygwin 中.假設您有 Cygwin 和 Anaconda 獨立工作,要從 Cygwin 訪問所有 Anaconda 工具,.bash_profile 中的以下設置似乎可以解決問題.(我只包含了那些與集成相關的 .bash_profile 部分......希望我不會無意中遺漏一些東西.)

After wrestling with the problem for quite some time, I think I've achieved a reasonable and workable method to integrate Anaconda's python (and associated environments) into Cygwin. Assuming you have both Cygwin and Anaconda working independently, to access all of the Anaconda tools from Cygwin, the following setup in .bash_profile seems to do the trick. (I have only included those portions of .bash_profile relevant to the integration... hoping I did not miss something inadvertently.)

這個設置基本上做了三件事.首先,用戶需要將目錄 $CONDA_BASE_DIR 顯式設置為 conda/anaconda/miniconda 基礎環境的安裝位置.其次,.bash_profile 中有一個功能,可以使用 shell 變量 $CONDA_DEFAULT_ENV 來跟蹤當前的 conda 環境.最后,我們定義一個別名 cyg-conda 和一個函數 cyg-activate 用作標準 conda 的替換命令>激活命令.請注意,變量名 $CONDA_DEFAULT_ENV 是特殊的,由實際的 conda 命令在內部使用.

This setup essentially does three things. First, the user needs to explicitly set the directory $CONDA_BASE_DIR to be the location where the base environment for conda/anaconda/miniconda was installed. Second, there is a functionality in .bash_profile to keep track of the current conda environment using a shell variable $CONDA_DEFAULT_ENV. And finally, we define an alias cyg-conda and a function cyg-activate to be used as replacement commands for the standard conda and activate commands. Please note that the variable name $CONDA_DEFAULT_ENV is special, and used internally by the actual conda command.

使用此設置,我可以像通常使用 conda 一樣使用 cyg-condacyg-activateactivate 在 Anaconda 命令提示符處,同時使環境可用于我的 Cygwin bash shell.

Using this setup, I am able to use cyg-conda and cyg-activate in the same way I would typically use conda and activate at the Anaconda command prompt, while making the environments available to my Cygwin bash shell.

當然愿意接受改進等方面的建議.

Certainly open to suggestions for improvements, etc.

###############################################################################

#  Anaconda Environment Selection - Plese set CONDA_BASE_DIR to the directory
#  containing the base installation of anaconda/miniconda.

export CONDA_BASE_DIR=/cygdrive/c/Users/Patrick/Miniconda3

#  Proxy Servers & Network Setup (if needed)

export HTTP_PROXY=
export HTTPS_PROXY=

#  IMPORTANT - Ignore carriage returns when using a Cygwin environment.

export SHELLOPTS
set -o igncr

###############################################################################

#  Manage conda environments for Python.  We check the environment variable
#  $CONDA_DEFAULT_ENV to see which environment is desired.  The default (root)
#  environment will be chosen if nothing is specified.  Note that this variable
#  will be explicitly managed by the cyg-activate ( ) function we have defined
#  below, specifically for the purpose of changing environments.  The root
#  environment is also handled slightly different from the others when it comes
#  to setting the CONDA_DEFAULT_ENV variable.

if [ ${CONDA_DEFAULT_ENV} ] && [ ${CONDA_DEFAULT_ENV} != 'root' ] 
then
    #  SELECT ONE OF THE NON-DEFAULT ENVIRONMENTS
    export CONDA_PREFIX=${CONDA_BASE_DIR}/envs/${CONDA_DEFAULT_ENV}
else
    #  SELECT THE DEFAULT ENVIRONMENT (and set CONDA_DEFAULT_ENV full path)
    export CONDA_DEFAULT_ENV=root
    export CONDA_PREFIX=${CONDA_BASE_DIR}
fi

###############################################################################

#  Define cyg-conda and cyg-activate to facilitate management of conda.

alias cyg-conda=${CONDA_BASE_DIR}/Scripts/conda.exe

cyg-activate() {
    export CONDA_DEFAULT_ENV=$1
    source ~/.bash_profile
    cyg-conda info --envs
}

###############################################################################

#  PATH - ALl of the anaconda/miniconda path entries appear first.

PATH=
PATH=$PATH:$CONDA_PREFIX
PATH=$PATH:$CONDA_PREFIX/Library/mingw-w64/bin
PATH=$PATH:$CONDA_PREFIX/Library/usr/bin
PATH=$PATH:$CONDA_PREFIX/Library/bin
PATH=$PATH:$CONDA_PREFIX/Scripts
PATH=$PATH:$HOME/scripts
PATH=$PATH:$HOME/local/bin
PATH=$PATH:/usr/local/bin
PATH=$PATH:/usr/bin

export PATH

###############################################################################

這篇關于在 Windows 上使用帶有 cygwin 的 anaconda 環境的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

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

相關文檔推薦

How to install Selenium in a conda environment?(如何在 conda 環境中安裝 Selenium?)
get the CUDA and CUDNN version on windows with Anaconda installe(使用 Anaconda installe 在 Windows 上獲取 CUDA 和 CUDNN 版本)
How can I download Anaconda for python 3.6(如何下載適用于 python 3.6 的 Anaconda)
Using two different Python Distributions(使用兩個不同的 Python 發行版)
How can I install Anaconda aside an existing pyenv installation on OSX?(除了 OSX 上現有的 pyenv 安裝之外,如何安裝 Anaconda?)
Permanently set Python path for Anaconda within Cygwin(在 Cygwin 中為 Anaconda 永久設置 Python 路徑)
主站蜘蛛池模板: 国产综合精品一区二区三区 | 国产成人一区二区三区 | 一区二区三区 在线 | 自拍视频网站 | 国产精品国产精品国产专区不片 | 精品福利一区二区三区 | 国产精品一区二区福利视频 | 蜜臀久久99精品久久久久久宅男 | 99精品国产一区二区青青牛奶 | 可以在线观看av的网站 | 在线欧美小视频 | 精品av| 精品中文字幕一区二区 | 国产精品成人一区二区三区夜夜夜 | 91综合在线视频 | 欧美一级免费黄色片 | 99re6在线视频精品免费 | 97精品超碰一区二区三区 | 欧美一级久久久猛烈a大片 日韩av免费在线观看 | 亚洲一区二区在线 | 国产精品视频久久 | 久久日韩精品 | 91资源在线 | 成年女人免费v片 | 91精品国产91久久综合桃花 | 国产亚洲精品a | 本道综合精品 | 亚洲欧洲国产视频 | 热久久久 | 一区二区三区网站 | 日韩国产中文字幕 | 日本免费在线 | 欧美午夜精品久久久久久浪潮 | 日韩国产一区二区三区 | 日韩欧美精品一区 | 午夜视频在线播放 | ww 255hh 在线观看 | 成人国产精品久久 | 亚洲一级毛片 | 中文字幕黄色大片 | 五月花丁香婷婷 |