Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What problems should be paid attention to when installing Python3.6 in Linux

2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)05/31 Report--

This article focuses on "what you need to pay attention to when installing Python3.6 in Linux", interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what you need to pay attention to when installing Python3.6 in Linux.

What can python do?

Python is a programming language with many effective tools built into it. Python can do almost anything. It is easy to understand, easy to use, powerful, and has been widely used in many fields, such as the most popular big data analysis, artificial intelligence, Web development and so on.

1. Installation depends on the environment

Various dependent libraries may be used during Python3 installation, so these dependent libraries need to be installed before Python3 is officially installed.

Yum-yinstallzlib-develobzip2-developennssl-developmenturses-develosqlite-develoreadline-develotk-develogdbm-developdb 4-develolibpcap-develoxz-develop

two。 Download the Python3 source code

There are two ways to download the source code of Python3. One is downloaded from the official website. The URL is as follows:

Https://www.python.org/downloads/source/

[image]

Another way is to download directly through wget, such as the following command:

Wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz

3. Create an installation directory

You can create an installation directory according to your preferences, for example, in / usr/local/python3:

Mkdir-p / usr/local/python3

4. Decompress the source package

To extract the source code package downloaded in step 2, the command is:

Tar-zxvf Python-3.6.1.tgz

5. Compile source code

After decompressing, go to the directory of the source code package, and then configure:

CdPython-3.6.1 . Before / configure-prefix=/usr/local/python 3 compiles and installs:

Do

6. Establish soft link manufacturing and installation of Python3

Ln-s/usr/local/python 3/bin/python 3/usr/bin/python 3

7. Add / usr/local/python3/bin to PATH

Edit the bash_profile to modify the environment variables:

Vim ~ / Bash_profile

Add the startup directory of Python3 under the PATH variable:

#. Bash_profile

# Getthealiasesandfunctions

If [- fallow /. Bash RC]; then. ~ /. If not, create

Field ionization (abbreviation for field ionization)

# user-specific environment and launcher

PATH=$ PATH: $HOME/bin: / usr/local/python 3/bin

After changing the export path, press Esc, and then enter: wq to save and exit.

8. Check whether Python3 and Pip3 are available

Execute the following command (note: v is uppercase v). If the results are consistent, then Python3 has been successfully installed.

[Alvin @ VM _ 0 _ 16 _ centos ~] $python 3murV

Python3.6.1

[alvin@VM_0_16_centos~] $pip3-V

Pip 9. 0. 1 from/usr/local/lib/python 3. 6/site-packages (python 3. 6)

Guide to avoiding the pit

In fact, for the installation of Python3, there are too many online posts, and the steps are similar. But there will be some trouble after the actual installation, especially for novices. Here are some common pits:

Pit 1:configure: error: no acceptable C compiler found in $PATH

The problem is relatively simple: the lack of a gcc compilation environment. You can install gcc:

Yum install-y gcc

Of course, in addition to that, you can also install it with source code.

Pit 2:zipimport.ZipImportError: can't decompress data

This problem is caused by the lack of related toolkits for zlib, so you only need to package the related dependencies:

Yum-y install zlib*

This can be solved by recompiling the source code after installation.

Pit 3:pip3: Can't connect to HTTPS URL because the SSL module is not available

The reason for this problem is that. / configure, if the-with-ssl parameter is not added, the ssl-related features of the software installed by default are not available simply because the pip3 process requires the SSL module, and this feature is not available because it is not specified. Solutions are as follows:

CdPython-3.6.2 . / configure-with-ssl

Do

Cheat 4:Multilib version problems, Sudo Makane Starr

It is obvious that there are multiple versions of the same library. Just delete the redundant version.

First query the existing version (take openssl as an example to check which conflict)

# rpm-qa | grepopenssl

Open SSL-devl-1. 0. 0-27. El 6 _ 4.2. X86 _ 64

Open SSL-1. 0. 0-27. El6 _ 4. 2. X86 _ 64

OpenSSL-1. OpenSSL-1 is installed in the Openssl-1.0.0-27.el6_4.2.i686 display system. 0. 0-27. El6 _ 4. 2. X86 _ 64 and openssl-1.0.0-27.el6_4.2.i686.

Rpm-erase-node PS openssl-1. 0. 0-27. El 6 _ 4. 2. I686 updates OpenSSL again:

# yum update 'openssl*'

Query openssl again to solve the problem!

# rpm-qa | grepopenssl

Open SSL-devl-1. 0. 1eMel 16. El 6 _ 5.7. X86 _ 64

OpenSSL-1. 0. 1e-16. El6 _ 5. 7. X86 _ 64 is what Linux needs to pay attention to when installing Python3.6.

At this point, I believe you have a deeper understanding of what you need to pay attention to when installing Python3.6 in Linux, so you might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report