Do not know whether the description is clear ... How do you run a script like this for a small white user who has no contact with the program?
Reply content:
It's an honor to thank you for inviting me.
Indeed, in the eyes of developers, the problem is quite simple, but for the average user, it's a really confusing question. This is also the great place to apply the distribution store.
This question actually contains two questions:
1. How do I use the code in GitHub?
2. How do I run a python program?
Question 1:
GitHub is more about developing users than ordinary users. For developers who are using GitHub at the beginning, you can refer to "How do I use GitHub?" "In the answer. But if you're a regular user, just want to use the program in a project (in my answer to another question, "How do I quickly delete all the questions and updates on the know?") For example), you can refer to the following steps:
Open the Project Address page, here is Leodas/zhihuhelper GitHub
, select "Download Zip" on the right side of the page to download the source code for the project, such as.
after the completion of the project to get the source compression package, in this case, the download of the compressed package file named Zhihuhelper-master.zip. Unzip the package and get the project source code. After the completion of the project to get the source compression package, in this case, the download of the compressed package file named Zhihuhelper-master.zip. Unzip the package and get the project source code.
Question 2:
To run a Python project, first make sure that the computer has the appropriate Python runtime environment. There are currently two versions of the mainstream Python project: Python 2.6+ and Python. The code between the two versions may have some compatibility issues that require a different operating environment for the specific project. In this example, the code is written based on the Python 2.7.6+. If the user's operating system is Mac OS or gnu/linux, then there is generally no need to install the Python runtime environment. If you are windows, you may need to download and install the operating environment on the official Python website. You can install it by following these steps:
Go to download page download Python
For different versions of Windows (32-bit/64-bit), select the corresponding installer, such as.
installation process no longer repeat, basically is the way "Next" in the end can. Installation process no longer repeat, basically is the way "Next" in the end can.
If you need support for other third-party libraries in the project that you want to run, you need to install the required third-party libraries. In this case, the project also needs to install requests and BeautifulSoup, and the installation of these two third-party libraries can refer to the following steps:
Enter requests to download and install
page, scroll to find the download link, such as.
Enter Go to BeautifulSoup download
pages, such as.
separately to download, get the source package Kennethreitz-requests-v2.2.1-28-g969195a.zip and beautifulsoup4-4.3.2.tar.gz, perform decompression. Separately to download, get the source package Kennethreitz-requests-v2.2.1-28-g969195a.zip and beautifulsoup4-4.3.2.tar.gz, perform decompression.
Use the shortcut key win+r to open the Run window, enter CMD, and execute, opening a command-line window.
My Python run environment is installed in the c:\python27\,requests and BeautifulSoup decompression paths are D:\src\kennethreitz-requests-969195a\, D:\src\, respectively. beautifulsoup4-4.3.2.
Refer to the above file information and execute it on the command line:
CD D:\src\kennethreitz-requests-969195a\
C:\Python27\python.exe setup.py Install
CD D:\src\beautifulsoup4-4.3.2
C:\Python27\python.exe setup.py Install
To install the two third-party libraries.
If there is no problem with the above steps, then there is already a running environment to perform the Python program in this example.
Assuming my code path is D:\src\ZhihuHelper-master\, use the command-line window to execute the command:
CD D:\src\ZhihuHelper-master\
C:\Python27\python.exe answer.py-u ' user@zhihu.com '-P ' 123456 '-b
You can back up all the answers for the logged-on user. Note that ' user@zhihu.com ' and ' 123456 ' need to be replaced with the login email and password corresponding to the account. If you add the-D parameter to the last command above, all of the user's answers will be deleted, and the-B and-D parameters can be used at the same time, and the answer will be backed up before the delete operation is performed. If the command is executed correctly, an answer backup file will be generated in D:\src\ZhihuHelper-master\ with the file name -answers. Although there is no file suffix, it can be viewed using text-editing files such as Notepad.
If you are a Mac OS user, you do not need to perform these tedious steps. Mac OS comes with Python runtime environment, but may still need to install requests and beautifulsoup dependencies, but the method is relatively simple, refer to the following steps:
Open terminal, execute command:
Easy_install requests
Easy_install BeautifulSoup
After the installation is complete, the Python program is used in a similar way.
-*-Gnu/linux users are not required to specify. -*-
==================================================================
The above steps seem tedious, But the execution of a Python project can be simpler. Helpless I am a python beginner Ah! Forgive me!
dug up a big hole for himself and finally filled it up. I'm here to defeating.
Install Cygwin and then
curl
| Python
- Download the code to your local computer: Click Download Zip on the right side of the page to
- Configure the Pyt locally Hon Environment, the method can be self-Google
- unzip the zip file just downloaded, open the command line, go to this directory, run Python xxx.py. Where xxx.py is a Python code file.
under Windows, install Python,linux and run it directly.