Managing the Python environment with Conda

Source: Internet
Author: User
Tags install pandas

First, motive

Recently intends to toss vn.py, but only py27 version, because always used to use the latest stable version, so have to install PY27 environment, have to say
Python's global lock is really annoying.
As a lazy cancer patient, it is necessary to use full-featured anaconda, but not with the fashion py27 and py35 two versions of the Anaconda Big Mac (two at a time,
Do not know whether Conda can also manage the environment, so choose to use Conda installed PYTHON27 environment and some necessary packages.
After a few days finally put the office computer and home Mac machine environment are well equipped, even with the official installation of textbooks, also stepped on a lot of pits.
(Because the main Futures trading API interface in China is only Windows and Linux editions, the environment on Mac can only be measured back and forth, unable to use vn.py's simulated trading and real-world functions.) )

Second, environmental management Conda common commands
    • View the environment under the current system
conda info -e
    • Create a new environment
# 指定python版本为2.7,注意至少需要指定python版本或者要安装的包# 后一种情况下,自动安装最新python版本conda create -n env_name python=2.7# 同时安装必要的包conda create -n env_name numpy matplotlib python=2.7
    • Environment switch
# 切换到新环境# linux/Mac下需要使用source activate env_nameactivate env_name#退出环境,也可以使用`activate root`切回root环境deactivate env_name
    • Removing an environment
conda remove -n env_name --all
Three, package management
    • There are two options for installing a package for a particular environment, one for direct installation in this environment, and the other for installing the environment parameter-n
activate env_nameconda install pandas# 安装anaconda发行版中所有的包conda install anaconda
conda install -n env_name pandas
    • View the package that is already installed
conda list# 指定查看某环境下安装的packageconda list -n env_name
    • Find Packages
conda search pyqtgraph
    • Update package
conda update numpyconda update anaconda
    • Uninstalling packages
conda remove numpy
Iv. Vnpy encountered in the environment configuration 1, 64-bit system and root environment specified installation 32-bit

The Python version and package used by VNPY in the window System are 32-bit, but unless downloaded Anaconda, the 32-bit version is downloaded.
Now most of the system is 64 bit, I also installed 64 bit, then use Conda install the default 64 bit, StackOverflow the discovery Solution
Pre-installation settings using 32-bit:

# 设置32位set CONDA_FORCE_32BIT=1conda create -n env_name python=2.7conda install numpy pandas# 切回系统默认set CONDA_FORCE_32BIT=
2, set the domestic mirror

Home with the Great Wall broadband, access to foreign resources of the internet can hardly endure, so see the next Conda there is no domestic mirror. And then I found one.
Tsinghua University TUNA Mirror TUNA Mirror Source
Site has a method of adding

# 需要去掉网址的引号conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --set show_channel_urls yes

If the command line method is not added, you can add https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/in the. Condarc in the user directory. :
If no file can be created directly, Windows is c://users/username/.condarc, Linux/mac is ~/.condarc
The results are as follows:

channels: - https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/  - defaultsshow_channel_urls: yes
Reference

Conda Documentation
Tsinghua Tuna Mirror
Anaconda Usage Summary

Managing the Python environment with Conda

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.