Python Virtual Environment setup

Source: Internet
Author: User
Tags virtual environment virtualenv install pandas jupyter jupyter notebook install matplotlib aliyun

How to build a python virtual environment
pyenv installing git# Yum install Git-ypython dependent package installation # Yum-y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-d Evel zlib-devel bzip2-devel Create python user # Useradd pythonpasswd python use python user login to download pyenv related packages curl-l https:// Raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | Bashvim. Bash_profile Add environment variable export path= "/home/python/.pyenv/bin: $PATH" eval "$ (pyenv init-)" eval "$ (pyenv Virtualenv-init-) "source. /home/python/.bash_profile or. /home/python/.bash_profilepython version and path path $ python--version$ python-v$ echo $PATHpyenv command $ pyenv$ pyenv Help install lists all Available versions $ pyenv Install--list installs the specified version $ pyenv install 3.5.3$ pyenv versions use the cache to install the pyenv installation 3.5.3-vcache directory, if the directory does not exist, create Built in the ~/.pyen directory, create a new cache directory, put the downloaded version of the file is not sure which file, the download of the 3 files are put in the following: CD ~/.pyenvmkdir cache settings python version $ pyenv Global 3.5.3 Remember that If you are using global because it is under a non-root user python user, if it is the root user installation, do not use global, otherwise the effect is too large use pyenv local setting current working directory start down recursion inherit this setting Pyenv shell only function current session $ pyenv Shell systemvirtualenv plug-in, plugins/pyenv-virtualenv$ pYenv virtualenv 3.5.3 magedu353 Create a 3.5.3 of independent space $ pyenv versions* system (set By/home/python/.pyenv/version) 3.5.33.6.1 Switch Virtual Environment pyenv local MAGEDU353PIP Common configuration $ mkdir ~/.pip profile in ~/.pip/pip.conf[global]index-url=https:// Mirrors.aliyun.com/pypi/simple/trusted-host=mirrors.aliyun.com Install the Redis package in a different virtual environment, use the PIP list to see the effect $ pip-v install ipython$ Pip Install ipython$ Ipython installs Jupyter, also installs Ipython's pip install jupyter$ jupyter notebook Helpjupyter-notebook password$ Jupyter Notebook--ip=0.0.0.0--no-browser
Windows installation Method
安装Python3.5 自带pippip install jupyterjupyter notebook helpjupyter-notebook passwordjupyter notebook --ip=0.0.0.0 --no-browserPython解释器
Method Two
Install virtualenv$ sudo pip install virtualenv and then build a test directory: $ mkdir testvirtual$ CD testvirtual You can successfully create a virtual environment env1:$ virtualenv en V1 can successfully create another virtual environment env2:$ Virtualenv env2 then want to enter into which virtual environment on the CD into it, such as into the env1:$ CD ENV1 installation Virtualenvwrappervirtaulenvwrapper is a virtualenv expansion pack that makes it easier to add, delete, copy, and switch virtual environments. Run the following command to install successfully, the default installation under/usr/local/bin: $ sudo easy_install virtualenvwrapper Next, create a folder to hold all virtual environments: $ mkdir ~/workspaces $ CD ~/workspaces First use which Virtualenvwrapper.shwhich python3 this command to find the correct path and then use VI ~/.bash_profile to enter export Workon_home= ' ~/. Virtualenvs ' Export virtualenvwrapper_python= '/users/mac/anaconda/bin/python3 ' source/users/mac/anaconda/bin/ Virtualenvwrapper.shesc after exiting: Wq save and then run this command source ~/.bash_profile Next, create one or more virtual environments env1,env2:$ mkvirtualenv ENV1 successfully, The current path will be preceded by (ENV1) $ mkvirtualenv env2 The following are some basic operations commands list Virtual environments: $ lsvirtualenv-benv1env2 Switch Virtual environment: $ Workon ENV1 See which packages are installed in the environment: $ Lssitepackages Enter the current environment: $ cdvirtualenv into the current environment site-packages:$ cdsitepackages$ cdsitepackages PIP replication Virtual Environment: $ cpvirtualenv Env1 env3copying env1 as Env3 ... Exit Virtual Environment: $ deacTivate Delete Virtual Environment: $ rmvirtualenv env2removing env2 ... Install Numpy,scipy,matplotlib, etc. next to install Python's various packages, it is more smooth, such as Ann on the ENV1: $ workon env1 Install Numpypip install Numpy installation scipy$ pip install SciPy Install matplotlib$ pip install matplotlib install ipython$ pip install Ipython[all] Install pandas$ pip Install Pandas install statsmodel$ Pip Install Statsmodel install scikit-learn$ pip install Scikit-learn

Python Virtual Environment setup

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.