Building a Python environment under Windows 64-bit systems

Source: Internet
Author: User
Tags pycharm download


Windows 64-bit development environment

Note: This tutorial is for Windows 7 64-bit operating systems and Windows 10 64-bit operating systems, and other systems have not been validated.

Installing the IDE


Pycharm Download: https://www.jetbrains.com/pycharm/


Installing the Python Environment


Python2.7 Download: https://www.python.org/downloads/



Python2.7 default installation directory inC:/Python27/, install directory do not transfer to another disk! Please pay special attention to patients with C-disk cleanliness disorder! .


Adding Python to environment variables
C:\Python27;C:\Python27\Scripts;


Add the above two paths to the system environment variable.


In the  my computer right-click Properties----, tap advanced system settings in the list on the left-----Advanced page, click the environment variable below-----in the system variable box, locate and select the variable named Path, and then click the Edit button below. Finally, the first (or last) of the variable value in the System Variable Edit dialog box is addedC:\Python27;C:\Python27\Scripts;(note that there is also a semicolon, do not miss the semicolon, the function of the semicolon is used to interval variables and variables.) )

Add Python2.7 to the registry of the Windows system


Create a new fileregister.pyand write:


 
 
import sys
from _winreg import *
version = sys.version[:3]
installpath = sys.prefix
regpath = "SOFTWARE\\Python\\Pythoncore\\%s\\" % (version)
installkey = "InstallPath"
pythonkey = "PythonPath"
pythonpath = "%s;%s\\Lib\\;%s\\DLLs\\" % (
    installpath, installpath, installpath
)
def RegisterPy():
    try:
        reg = OpenKey(HKEY_CURRENT_USER, regpath)
    except EnvironmentError as e:
        try:
            reg = CreateKey(HKEY_CURRENT_USER, regpath)
            SetValue(reg, installkey, REG_SZ, installpath)
            SetValue(reg, pythonkey, REG_SZ, pythonpath)
            CloseKey(reg)
        except:
            print "*** Unable to register!"
            return
        print "--- Python", version, "is now registered!"
        return
    if (QueryValue(reg, installkey) == installpath and
        QueryValue(reg, pythonkey) == pythonpath):
        CloseKey(reg)
        print "=== Python", version, "is already registered!"
        return
    CloseKey(reg)
    print "*** Unable to register!"
    print "*** You probably have another Python installation!"
if __name__ == "__main__":
    RegisterPy()


After entering the directory where the register.py is located, execute:


python register.py
Installing Pywin32


Pywin32 Download: Https://nchc.dl.sourceforge.net/project/pywin32/pywin32/Build%20219/pywin32-219.win-amd64-py2.7.exe


Installing VCFORPYTHON27


VCForPython27 Download: Https://download.microsoft.com/download/7/9/6/796EF2E4-801B-4FC4-AB28-B59FBF6D907B/VCForPython27.msi


Install and upgrade PIP installation pip


Download get-pip.py file: https://bootstrap.pypa.io/get-pip.py



After entering the directory where the get-pip.py is located, execute:


python get-pip.py
Upgrade Pip
python -m pip install -U pip
Installing lxml


Some students may have doubts, said the direct usepip install lxmlof the installation is not OK? I haven't tried it a few times anyway. Or honestly download the WHL file, and then install it locally. Let's just say that if you're having problems with an online installation, you can fix the problem by installing it locally.
Recommend a download website: https://www.lfd.uci.edu/~gohlke/pythonlibs/
There are commonly used Python class libraries.



lxml Download: https://www.lfd.uci.edu/~gohlke/pythonlibs/#lxml



Find the corresponding version of the download, and then go to the lxml download directory, execute:


pip install lxml?4.1.1?cp27?cp27m?win_amd64.whl
Installing Mysql-python


Similarly, Mysql-python download: https://www.lfd.uci.edu/~gohlke/pythonlibs/#mysql-python



Enter the download directory of the Mysql-python and execute:


pip install MySQL_python?1.2.5?cp27?none?win_amd64.whl
Installing the Scrapy crawler frame
pip install Scrapy
Installing the Flask WEB framework
pip install flask
Last Words


To be honest, the Windows platform is not suitable for the development of some languages, especially Web-oriented. You can use MacOS or Linux or don't use Windows. Why do you have this article, not to give the environment to colleagues who use Windows? Say more is a tear.



Building a Python environment under Windows 64-bit systems


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.