Detailed explanation of the steps to install pip3 in python3
This time I will bring you python3 a detailed explanation of the steps to install pip3, what are the precautions for installing pip3 in python3, the following is a practical case, let's take a look.
Foreword:
The server I am currently using is centos6.x. The version of python that comes with the system is 2.6.x. However, whether I am learning or using python, python3 is the first choice, so here comes the problem. ---How to install the python3 environment, and how to install the corresponding pip3 for python3? More importantly, there are some built-in tools in our original system that require the python2.6 version, so the coexistence of python3 and python2, and the coexistence of pip2 and pip3 are required. The following article is my personal practice. (Install pip3 for python3)
The purpose of writing this article is to help comrades who also encounter the same problem (currently it is difficult to find information on the Internet, and most of it has not been practiced. The following is my experience, 100% Can succeed! Go! Go!)
##First, install python3.x, so easzy! ! 1. First go to the official website to download the python3 installation package
Official website address ---I downloaded Python-3.5.2.tar.xz
2. Upload Package to server
3. Unzip
tar -xf Python-3.5.2.tar.xz
4. Compile and install
! ! ! ! Pay attention
⚠️ You need to install some necessary dependencies before compiling, otherwise you have to recompile when an error is reported---(I suffered this loss, so be careful...)Install the necessary dependencies (at least the following two are required, I personally encountered the following two) yum install openssl-devel -y
yum install zlib-devel -y
Okay, now you can compile with peace of mind:
cd Python-3.5.2 ./configure --prefix=/opt/Python #安装目录可以自己定义无所谓。 make make install
After the compilation is completed, it will Generate a Python folder under /opt/. Yes, this is the compiled python - for convenience, friends can define a soft link as follows:
# ln -s /opt/Python/bin/python3 /usr/bin/python3
In this way, you can directly consume python3 As follows:
Okay so far, our task of installing python3 under Linux has been completed. Let’s enter the key point and install pip3 for python3
In fact, this is not difficult. . Download several packages and execute two commands to get it done. 1. First install setuptools
Friends can download it through the official module library: Download address
Here I directly use wget to download the version 19.6 from the server (Friends, you can try the new version...)
wget --no-check-certificate https://pypi.python.org/packages/source/s/setuptools/setuptools-19.6.tar.gz#md5=c607dd118eae682c44ed146367a17e26 tar -zxvf setuptools-19.6.tar.gz cd setuptools-19.6.tar.gz python3 setup.py build python3 setup.py install
2. Then install pip directly and you're done. .
Similarly download it first and then execute the command to get it done! !
wget --no-check-certificate https://pypi.python.org/packages/source/p/pip/pip-8.0.2.tar.gz#md5=3a73c4188f8dbad6a1e6f6d44d117eeb tar -zxvf pip-8.0.2.tar.gz cd pip-8.0.2 python3 setup.py build python3 setup.py install
After the installation is complete, let’s take a look at what is in the bin directory of python
Haha. . Through the above we have installed pip3 for python3. . . (Friends can also make a soft connection for convenience and practicality...)
1. First, let’s enter python3[root@centos3 bin]# python3
Python 3.5.2 (default, Jul 27 2016, 03:36:56)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import pymysql
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named 'pymysql' ##没有此模块奥
>>></module></stdin>
Okay, let’s try to install it with the newly installed pip3:
[root@centos3 bin]# /opt/Python/bin/pip3 install pymysql Collecting pymysql Downloading PyMySQL-0.7.5-py2.py3-none-any.whl (77kB) 100% |████████████████████████████████| 81kB 3.2kB/s Installing collected packages: pymysql Successfully installed pymysql-0.7.5 ######安装完成
The installation is complete. It seems that there is no problem with pip3 itself. Let’s test whether it is really installed for python3. Module (maybe it is installed on python2...-_-#)
[root@centos3 bin]# python3 Python 3.5.2 (default, Jul 27 2016, 03:36:56) [GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import pymysql >>>
Hahaha ok. . Finish! !
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!
Recommended reading:
How to implement Mahalanobis distance in Python##The perfect solution to the inability to use pip in python2.7
The above is the detailed content of Detailed explanation of the steps to install pip3 in python3. For more information, please follow other related articles on the PHP Chinese website!
The Main Purpose of Python: Flexibility and Ease of UseApr 17, 2025 am 12:14 AMPython's flexibility is reflected in multi-paradigm support and dynamic type systems, while ease of use comes from a simple syntax and rich standard library. 1. Flexibility: Supports object-oriented, functional and procedural programming, and dynamic type systems improve development efficiency. 2. Ease of use: The grammar is close to natural language, the standard library covers a wide range of functions, and simplifies the development process.
Python: The Power of Versatile ProgrammingApr 17, 2025 am 12:09 AMPython is highly favored for its simplicity and power, suitable for all needs from beginners to advanced developers. Its versatility is reflected in: 1) Easy to learn and use, simple syntax; 2) Rich libraries and frameworks, such as NumPy, Pandas, etc.; 3) Cross-platform support, which can be run on a variety of operating systems; 4) Suitable for scripting and automation tasks to improve work efficiency.
Learning Python in 2 Hours a Day: A Practical GuideApr 17, 2025 am 12:05 AMYes, learn Python in two hours a day. 1. Develop a reasonable study plan, 2. Select the right learning resources, 3. Consolidate the knowledge learned through practice. These steps can help you master Python in a short time.
Python vs. C : Pros and Cons for DevelopersApr 17, 2025 am 12:04 AMPython is suitable for rapid development and data processing, while C is suitable for high performance and underlying control. 1) Python is easy to use, with concise syntax, and is suitable for data science and web development. 2) C has high performance and accurate control, and is often used in gaming and system programming.
Python: Time Commitment and Learning PaceApr 17, 2025 am 12:03 AMThe time required to learn Python varies from person to person, mainly influenced by previous programming experience, learning motivation, learning resources and methods, and learning rhythm. Set realistic learning goals and learn best through practical projects.
Python: Automation, Scripting, and Task ManagementApr 16, 2025 am 12:14 AMPython excels in automation, scripting, and task management. 1) Automation: File backup is realized through standard libraries such as os and shutil. 2) Script writing: Use the psutil library to monitor system resources. 3) Task management: Use the schedule library to schedule tasks. Python's ease of use and rich library support makes it the preferred tool in these areas.
Python and Time: Making the Most of Your Study TimeApr 14, 2025 am 12:02 AMTo maximize the efficiency of learning Python in a limited time, you can use Python's datetime, time, and schedule modules. 1. The datetime module is used to record and plan learning time. 2. The time module helps to set study and rest time. 3. The schedule module automatically arranges weekly learning tasks.
Python: Games, GUIs, and MoreApr 13, 2025 am 12:14 AMPython excels in gaming and GUI development. 1) Game development uses Pygame, providing drawing, audio and other functions, which are suitable for creating 2D games. 2) GUI development can choose Tkinter or PyQt. Tkinter is simple and easy to use, PyQt has rich functions and is suitable for professional development.


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Zend Studio 13.0.1
Powerful PHP integrated development environment

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment






