Conda常用

conda 简单使用

conda是anaconda里自带的一个工具,结合了pip、virtualENV等多个工具,可以方便的管理python环境和包!

用conda创建一个名叫python2的版本为python2.7的环境。

conda create -n python2 python=2.7
这样就会在Anaconda安装目录下的envs目录下创建python2这个目录。

 

 

向其中安装扩展可以:

直接用 conda install 并用 -n 指明安装到的环境,这里自然就是 python2 。
像 virtualenv 那样,先activate,然后在虚拟环境中安装。
这里突然有一个问题,怎样在IDE中使用创建出来的环境?如果是PyCharm等IDE,直接设置Python安装目录就可以了。那spyder呢?其实spyder就是一个Python的扩展,你需要在虚拟环境中也装一个spyder。

 

$ conda create -n py33test anaconda=1.9 python=3.3 numpy=1.8

$ source activate py33test

Single libraries and packages can be installed using the  conda install command, either
in the general  Anaconda installation:
$ conda install scipy
or for a specific environment, as in:
$ conda install -n py33test scipy
Here,  py33test is the environment we created before. Similarly, you can update single
packages easily:
$ conda update pandas
The packages to download and link depend on the respective version of the package that is
installed. These can be very few to numerous, e.g., when a package has a number of
www.it-ebooks.info
dependencies for which no current version is installed. For our newly created
environment, the updating would take the form:
$ conda update -n py33test pandas
Finally,  conda makes it easy to remove packages with the  remove command from the main
installation or a specific environment. The basic usage is:
$ conda remove scipy
For an environment it is:
$ conda remove -n py33test scipy
Since the removal is a somewhat “final” operation, you might want to dry run the
command:
$ conda remove —dry-run -n py33test scipy
If you are sure, you can go ahead with the actual removal. To get back to the original
Python and  Anaconda version, deactivate the environment:
$ source deactivate
Finally, we can clean up the whole environment by use of  remove with the option  —all :
$ conda remove —all -n py33test
The package manager  conda makes  Python deployment quite convenient. Apart from the
basic functionalities illustrated in this section, there are also a number of more advanced
features available. Detailed documentation is found at http://conda.pydata.org/docs/.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值