Python Course first week environment preparation

Source: Internet
Author: User
Tags virtual environment virtualenv jupyter aliyun

Environment preparation, install version control software pyenv

1. Install pyenv using Pyenv-installer

Curl-l Https://raw.githubusercontent.com/yyuu/pyenv-installer/master/bin/pyenv-installer | Bash


2. Add environment variables to the bash script

Vim ~/.bash_profileexport path= "~/.pyenv/bin: $PATH" eval "(pyenv init-)" eval "(pyenv virtualenv-init-)"


3. Installing python3.5.2

Install the build tool first:

Yum install-y gcc make patch

To install a dependency package:

Yum install-y gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel

Installing python3.5.2

Pyenv Install 3.5.2

This will be downloaded from the python.org official website python-3.5.2.tgz installation package, but because the domestic network environment is poor, so download speed is very slow, you can download the PYTHON-3.5.2.TGZ installation package, in the. pyenv directory to create the cache directory, after the installation package upload to the directory Re-install:

mkdir. PYENV/CACHECP python-3.5.2.tgz. Pyenv/cache/python-3.5.2.tar.gzpyenv Install 3.5.2

This will install Python3.5.2 directly from the directory.

View Python version information in the current directory after installation is complete

Python-v

650) this.width=650; "src=" Http://s1.51cto.com/wyfs02/M02/8B/56/wKioL1hKKAajart6AAAIT4hdDFA687.jpg "title=" 918f.tmp.jpg "alt=" Wkiol1hkkaajart6aaait4hddfa687.jpg "/>


4. Common PYENV Commands

Pyenv versions View the version of Python that is already installed, pyenv version view the current Python version pyenv local 3.5.2 The Python environment in the current directory switches to 3.5.2 version Pyenv local syste M the python environment in the current directory is switched to the system version PYENV global 3.5.2 Switches the entire system's Python environment to 3.5.2 version (do not operate!) ) pyenv commands View pyenv commands that can be executed pyenv install 3.5.2 installation python3.5.2 version pyenv uninstall 3.5.2 Uninstall python3.5.2 version


5. Pyenv virtualenv Configuration

Use the virtualenv command to establish a standalone virtual environment in which different software versions can be configured separately, using the following commands:

Pyenv virtualenv 3.5.2 Test Create a virtual environment test, switch to the virtual test environment using the python3.5.2 version pyenv local test

In pyenv programs, virtual environments created using the VIRTUALENV command can use

Pyenv versions

See, you'll also see a 3.5.2/envs/test, because the test virtual environment you created is actually built under the 3.5.2 version, so all the environment profiles will be under the version number directory. The test information you see with pyenv versions is actually just a soft link.


Configuration of 6.jupyter

Jupyter is an IDE tool that allows you to view current project information online on a Web page with the following installation process:

Pyenv local 3.5.2pip install Jupyterjupyter notebook--ip=0.0.0.0

The last command starts Jupyter, and then listens on the 8888 port of the extranet IP, and listens on localhost:8888 without--ip= "ip_address".

Open the browser, use http://host_ip:8888 to access Jupyter, use http://localhost:8888 access on the local computer.


7. PIP installation environment configuration, using PIP to install the software, the default is also directly from the foreign source installation, slower, so try to switch to the domestic source installation:

Create a configuration file directly in the. Pip directory

Vim ~/.pip/pip.conf[global]timeout=300index-url=http://mirrors.aliyun.com/pypi/simple/trusted-host = Mirrors.aliyun.com



This article is from the "No Flying World" blog, please be sure to keep this source http://hf1208.blog.51cto.com/8957433/1881102

Python Course first week environment preparation

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.