I don't know whether the description is clear... how should I run such a script for a small white user who has never touched programming? I don't know whether the description is clear... how should I run such a script for a small white user who has never touched programming? Reply: Thank you for your invitation.
Indeed, in the eyes of developers, this problem is quite simple, but it is indeed a confusing problem for common users. This is also the greatness of the app distribution store.
This question actually contains two problems:
1. How to Use the code in GitHub?
2. How to run a Python program?
Question 1:
GitHub targets developers rather than common users. For developers who are using Github, refer to "How to use GitHub ?」 . However, if you are a common user, you just want to use a program in a project (in my answer to another question, "How can you quickly delete all questions and the latest news on zhihu ?」 For example, follow these steps:
Open the Project address page, which is leodas/ZhihuHelper GitHub.
Select "Download Zip" on the right side of the page to Download the source code of the project, as shown in.
The destination source code package is obtained after completion. In this example, the compressed package file is named zhihuhelper-master.zip. Decompress the package to obtain the source code of the project. The destination source code package is obtained after completion. In this example, the compressed package file is named zhihuhelper-master.zip. Decompress the package to obtain the source code of the project.
Question 2:
To run a Python project, make sure that the computer has a suitable Python runtime environment. Currently, there are two mainstream Python projects: Python 2.6 + and Python 3 +. The code of the two versions may have some compatibility issues. You need to provide different runtime environments for specific projects. In this example, the code is written based on Python 2.7.6 +. If your operating system is Mac OS or GNU/Linux, you generally do not need to install the Python runtime environment. For Windows, you may need to download and install the runtime environment on the official Python website. Follow these steps to install the SDK:
Go to the Download page and Download Python
For different Windows versions (32-bit/64-bit), select the corresponding installer, as shown in.
The installation process will not be described in detail. Basically, it is just one "Next" to the end. The installation process will not be described in detail. Basically, it is just one "Next" to the end.
If other third-party libraries are required for the project to be run, install the required third-party libraries. In this example, the project also needs to install Requests and BeautifulSoup. to install these two third-party libraries, follow these steps:
Download and install Requests
Page, scroll to the page to find the download link, as shown in.
Enter Go to BeautifulSoup to download
Page, such.
Decompress the package. Decompress the package.
Use the shortcut key Win + R to open the Run window, Enter cmd and execute, and open a command line window.
My Python runtime environment is installed in C: \ Python27 \, Requests and BeautifulSoup unzip paths are D: \ src \ kennethreitz-requests-969195a \, D: \ src \ beautifulsoup4-4.3.2.
Refer to the above file information and run the following command in the command line:
Cd D: \ src \ kennethreitz-requests-969195a \
C: \ Python27 \ python.exe setup. py install
CDD: \ src \ beautifulsoup4-4.3.2
C: \ Python27 \ python.exe setup. py install
You can install these two third-party libraries.
If the preceding steps are correct, the running environment of the Python program in this example is ready.
Assume that my code path is D: \ src \ ZhihuHelper-master \. In the command line window, run the following 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 logged-on users. Note: replace 'user @ zhihu.com 'and '123' with the logon email address and password of the corresponding zhihu account. If the-d parameter is added to the last command, all the answers of the user will be deleted. If the-B and-d parameters can be used simultaneously, the answer will be backed up first, then perform the delete operation. If the command execution is correct, the answer backup file will be generated in D: \ src \ ZhihuHelper-master \. The file name is -Answers. Although there is no file suffix, you can use Notepad and other text editing files for viewing.
If you are a Mac OS user, you do not need to perform the preceding steps. Mac OS comes with a Python runtime environment. However, you may still need to install the Requests and BeautifulSoup dependencies. However, the method is relatively simple. refer to the following steps:
Start the terminal and run the following command:
Easy_install requests
Easy_install BeautifulSoup
After the installation is complete, the method for using the Python program is similar to the above.
-*-GNU/Linux users are not required to describe. -*-
========================================================== ======================================
Although the above steps seem cumbersome, the execution of the Python project can be simpler. I am a beginner in Python! Forgive me!
I dug a big hole for myself and finally filled it out. I am here to split the platform...
Install Cygwin and
curl
| python
- Download the code to your local computer: Click Download Zip on the right side of the page.
- To configure the Python environment locally, Google
- Decompress the downloaded zip file, open the command line, enter the directory, and run python xxx. py. Xxx. py is a Python code file.
Install python in Windows and run python in Linux.