Install Easy_install and pip tutorials under windows

Source: Internet
Author: User

Both Easy_install and Pip are used to download the relevant resource bundle for installing Python in a common repository pypi.

Install Easy_install First

: Https://pypi.python.org/pypi/ez_setup

Unzip, install the method cmd into the corresponding directory, execute the command: Python ez_setup.py
------------------------------------
C:\users\administrator>d:

D:\>CD D:\download\ez_setup-0.9

D:\download\ez_setup-0.9>python ez_setup.py
Downloading http://pypi.python.org/packages/source/d/distribute/distribute-0.6.1
4.tar.gz
Extracting in C:\USERS\ADMINI~1\APPDATA\LOCAL\TEMP\TMPUFDLXZTC
Now working in c:\users\admini~1\appdata\local\temp\tmpufdlxztc\distribute-0.6.1
4
Installing distribute
Creating build
Creating BUILD\SRC
.....

============================================

Install PIP after installing Easy_install.

: Https://pypi.python.org/pypi/pip

Unzip, install command: Python setup.py install
--------------------------------------------
D:\DOWNLOAD\EZ_SETUP-0.9>CD D:\download\pip-7.1.0

D:\download\pip-7.1.0>python setup.py Install

.....

Running Install_egg_info
Writing D:\Python34\Lib\site-packages\pip-7.1.0-py3.4.egg-info

D:\download\pip-7.1.0>

Update PIP command:
Pip Install--upgrade pip

==============================

Example: Installing BEAUTIFULSOUP4 directly with PIP

F:\kanbox\pythoncode\zyspider>pip Install BEAUTIFULSOUP4
Collecting BEAUTIFULSOUP4
Downloading BEAUTIFULSOUP4-4.4.0-PY3-NONE-ANY.WHL (80kB)
40% |█████████████| 32kB 262kb/s ETA 0:00:01
45% |██████████████▋| 36kB 262kb/s ETA 0:00:
50% |████████████████▏| 40kB 291kb/s ETA 0:0
55% |█████████████████▉| 45kB 291kb/s ETA 0:
60% |███████████████████▍| 49kB 201kb/s ETA
65% |█████████████████████| 53kB 187kb/s ETA
70% |██████████████████████▋| 57kB 187kb/s E
75% |████████████████████████▎| 61kB 187kb/s
80% |██████████████████████████| 65kB 187kb/
86% |███████████████████████████▌| 69kB 201k
91% |█████████████████████████████▏| 73kB 43
96% |██████████████████████████████▊| 77kB 4
100% |████████████████████████████████| 81kB
328kb/s
Installing collected PACKAGES:BEAUTIFULSOUP4
Successfully installed beautifulsoup4-4.4.0

F:\kanbox\pythoncode\zyspider>

=========================================
Python2.7 installation beautifulsoup4-4.4.0:http://www.crummy.com/software/beautifulsoup/bs4/download/4.4/
Installation method: cmd, CD into the directory where BeautifulSoup setup.py is located (for example: D:\download\beautifulsoup4-4.4.0), and then run
Python setup.py Build
Python setup.py Install
Version upgrade to 4, the introduction of the package to use
Import BS4
From BS4 import BeautifulSoup
cannot be used directly
From BeautifulSoup import BeautifulSoup

python3.4 can be used directly from the BS4 import BeautifulSoup

Note: Installing 2.7 and 3.4 on the same computer will cause the PIP command to not install in 2.7 cases BEAUTIFULSOUP4

==================================

Python script is ok, but execution total error "Attributeerror: ' Module ' object has no attribute ' xxx '". There is a problem with the. pyc file.
Problem Locator:
View the source file of the import library, discover that the source file exists without errors, and that the. pyc file exists for the source file.
Problem Solving methods:
1. When naming the Py script, do not match the python reserved word, module name, etc.
2. Delete the. pyc file for the library (because the. pyc file is generated by the PY script each time it is run; if the. pyc file is already generated, the runtime will still walk PYC if the code is not updated, so delete the. pyc file) and rerun the code;
Or find an environment where you can run the code, and copy the. pyc file that replaces the current machine.

-------------------------

PYc File Description
The PYc file, which is a python-compiled bytecode (bytecode) file. As soon as you run the py file, the Python compiler will automatically generate a corresponding PYC bytecode file. This PYC bytecode file, after the Python interpreter, generates machine code to run (which is why the PYc file can be deployed across platforms, similar to Java's cross-platform, a bytecode file run by the JVM in Java). The next call calls PYc directly, without invoking the py file. Until you have changed this py file. The Python interpreter checks the build time in the PYc file to compare the modification time of the Py file and, if the PY is updated, generates a new PYC.

Transferred from: www.cnblogs.com/zdz8207/p/python_learn_note_16.html

Install Easy_install and pip tutorials under windows

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.