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

Anaconda:永久包含外部包(如在 PYTHONPATH 中)

Anaconda: Permanently include external packages (like in PYTHONPATH)(Anaconda:永久包含外部包(如在 PYTHONPATH 中))
本文介紹了Anaconda:永久包含外部包(如在 PYTHONPATH 中)的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

問題描述

我知道如何使用 conda install 在 Anaconda 中安裝軟件包,以及如何安裝 PyPi 在 manual 中有描述.p>

但是如何將包/文件夾永久包含在 Anaconda 環(huán)境的 PYTHONPATH 中,以便可以導(dǎo)入我當(dāng)前正在處理的代碼并且在重新啟動(dòng)后仍然可用?

我目前的做法是使用sys:

導(dǎo)入系統(tǒng)sys.path.append(r'/path/to/my/package')

這不是很方便.

有什么提示嗎?

提前致謝!

解決方案

我在 Anaconda 論壇:

1.) 將模塊放入站點(diǎn)包中,即 $HOME/path/to/anaconda/lib/pythonX.X/site-packages 目錄,它總是在 上sys.path.這也應(yīng)該通過創(chuàng)建符號(hào)鏈接來工作.

2.) 將 .pth 文件添加到目錄 $HOME/path/to/anaconda/lib/pythonX.X/site-packages.這可以命名為任何名稱(它必須以 .pth 結(jié)尾)..pth 文件只是一個(gè)以換行符分隔的目錄的完整路徑名列表,這些目錄將在 Python 啟動(dòng)時(shí)添加到您的路徑中.

或者,如果您只想鏈接到特定的 conda 環(huán)境,請(qǐng)將 .pth 文件添加到 ~/anaconda3/envs/{NAME_OF_ENVIRONMENT}/lib/pythonX.X/site-packages/

兩者都很簡(jiǎn)單,我選擇了第二個(gè)選項(xiàng),因?yàn)樗`活.

***更新:

3.) 使用 conda develop 一世.e.conda-develop/path/to/module/ 添加創(chuàng)建 .pth 文件的模塊,如選項(xiàng) 2 所述.).

4.) 在包的文件夾中創(chuàng)建一個(gè) setup.py并使用 pip install -e/path/to/package 安裝它,從我的角度來看,這是最干凈的選項(xiàng),因?yàn)槟€可以使用 pip list 查看所有安裝.請(qǐng)注意,選項(xiàng) -e 允許編輯包代碼.請(qǐng)參閱此處了解更多信息.

還是謝謝!

I know how to install packages in Anaconda using conda install and also how to install packages that are on PyPi which is described in the manual.

But how can I permanently include packages/folders into the PYTHONPATH of an Anaconda environment so that code that I am currently working on can be imported and is still available after a reboot?

My current approach is to use sys:

import sys
sys.path.append(r'/path/to/my/package')

which is not really convenient.

Any hints?

Thanks in advance!

解決方案

I found two answers to my question in the Anaconda forum:

1.) Put the modules into into site-packages, i.e. the directory $HOME/path/to/anaconda/lib/pythonX.X/site-packages which is always on sys.path. This should also work by creating a symbolic link.

2.) Add a .pth file to the directory $HOME/path/to/anaconda/lib/pythonX.X/site-packages. This can be named anything (it just must end with .pth). A .pth file is just a newline-separated listing of the full path-names of directories that will be added to your path on Python startup.

Alternatively, if you only want to link to a particular conda environment then add the .pth file to ~/anaconda3/envs/{NAME_OF_ENVIRONMENT}/lib/pythonX.X/site-packages/

Both work straightforward and I went for the second option as it is more flexible.

*** UPDATE:

3.) Use conda develop i. e. conda-develop /path/to/module/ to add the module which creates a .pth file as described under option 2.).

4.) Create a setup.py in the folder of your package and install it using pip install -e /path/to/package which is the cleanest option from my point of view because you can also see all installations using pip list. Note that the option -e allows to edit the package code. See here for more information.

Thanks anyway!

這篇關(guān)于Anaconda:永久包含外部包(如在 PYTHONPATH 中)的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

相關(guān)文檔推薦

Troubles while parsing with python very large xml file(使用 python 解析非常大的 xml 文件時(shí)出現(xiàn)問題)
Find all nodes by attribute in XML using Python 2(使用 Python 2 在 XML 中按屬性查找所有節(jié)點(diǎn))
Python - How to parse xml response and store a elements value in a variable?(Python - 如何解析 xml 響應(yīng)并將元素值存儲(chǔ)在變量中?)
How to get XML tag value in Python(如何在 Python 中獲取 XML 標(biāo)記值)
How to correctly parse utf-8 xml with ElementTree?(如何使用 ElementTree 正確解析 utf-8 xml?)
Parse XML from URL into python object(將 XML 從 URL 解析為 python 對(duì)象)
主站蜘蛛池模板: 国产成人免费视频 | 91porn国产成人福利 | 黄色一级大片在线免费看产 | 国产精品视频一 | 成人午夜影院 | 亚洲欧美在线视频 | 亚洲精品99 | 欧美一二三四成人免费视频 | 天堂一区二区三区 | 国产亚洲二区 | 日韩欧美国产一区二区 | 91中文字幕在线 | 国产精品久久久久久久久久久久冷 | 成人精品一区亚洲午夜久久久 | 男女啪啪高潮无遮挡免费动态 | 中文字幕成人在线 | 免费成人高清在线视频 | 91热爆在线观看 | 91传媒在线播放 | 中文字幕在线免费观看 | 精品国产一区二区三区在线观看 | 成人欧美一区二区三区黑人孕妇 | 日韩视频在线一区二区 | 中文字幕av在线一二三区 | 精品视频国产 | 精品久久久久久亚洲综合网站 | 午夜精品一区二区三区免费视频 | 给我免费的视频在线观看 | 欧美日韩亚洲国产 | 中文成人在线 | 久久久久久a| 久久久妇女国产精品影视 | 日韩中文字幕在线视频 | 日韩不卡视频在线 | 亚洲成人精品影院 | 国产精品亚洲精品日韩已方 | 操操日| 欧美日韩成人在线 | a黄视频| 欧美一区视频在线 | 91看片免费 |