Anaconda包查找,conda自定义本地channel作为python|Anaconda包查找,conda自定义本地channel作为python package源进行离线安装,离线创建环境
http://user.qzone.qq.com/892054726/blog/1467193413 参考链接:http://conda.pydata.org/docs/custom-channels.html
http://conda.pydata.org/docs/config.html#channel-locations-channels
安装HappyBase等Python包
文章图片
默认的channel中没有happybase,需要从anaconda查找。
文章图片
接下来使用conda-forge中的happybase安装(指定channel 为conda-forge):
文章图片
接下来再安装PostgreSQL的包:
文章图片
添加国内镜像源
如果网络连接有问题,可以
添加一个清华大学的TUNA镜像源: 【Anaconda包查找,conda自定义本地channel作为python|Anaconda包查找,conda自定义本地channel作为python package源进行离线安装,离线创建环境】https://mirrors.tuna.tsinghua.edu.cn/help/anaconda/
conda config --add channels 'https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/'
conda config --set show_channel_urls yes
文章图片
查看.condarc文件的内容,已经加入的清华的源:
文章图片
查找包,可以看到把各个源的包都列了出来:
文章图片
自定义本地channel
Channels are the path that conda takes to look for packages, and the easiest way to use and manage custom channels is to use a private or public repository on
Anaconda.org
, formerly known as Binstar.org. If you designate your Anaconda.org repository as private, then only you, and those you grant access, can access your private repository. If you do not wish to upload your packages to the internet, however, you can build a custom repository served either through a web server, or locally using a file:// url.
1.Organize packages into platform subdirectories
将python 包放在各个平台的文件夹下:
文章图片
下图是从
在线Linux服务器Anaconda2\pkgs拷贝到离线服务器pkgs文件夹下的linux-64目录后的结果:
文章图片
2. 在各个子目录运行conda index
conda indexlinux-64
文章图片
我们只运行linux目录。运行完成后,会在每个目录下产生一个文件repodata.json
3. 测试
运行如下命令,显示本地可用包:
conda search -c file://opt/channel/ --override-channels
Note: the –override-channels is to be sure conda only searches your specified channel and no other channels, such as default channels or any other channels you may have listed in your .condarc file.
文章图片
除了每次指定本地源的方法外,还可以在用户根目录下的配置文件.condarc里进行设置:
channels
:
- file://opt/channel/
- defaults
# Show channel URLs when displaying what is going to be downloaded and
# in 'conda list'.
The default is False.
show_channel_urls
: True
离线创建自定义环境
文章图片