I recently learned Python. Since some modules are more effective under Linux, I installed a Linux 6.5 virtual machine on this machine using Oracle VM VitualBox. The learning environment Python uses 3.5+, and Linux comes with 2.6.6, so you need to install the new version. . The process is as follows (with yum source configuration)
I won’t go into details about the virtual machine installation process. The main thing is to configure the network. I set the host-only mode, and configured a fixed IP on the virtual machine, and started it. , use the xmanager tool to connect. No big deal. If you have any questions, please call Baidu.
---------------Separating line, the entire process is logged in with the root account. Now let’s get to the point----------------
Steps:
1. Download python3.6, and then upload it using the FTP tool.
2. Use the command to decompress. For reference, you can change it to your version tar -zxvf Python-3.6.1.tgz
3. Enter the directory and execute ./configure --prefix=/ usr/local/python3
An error occurred during this process, configure: error: no acceptable C compiler found in $PATH. After checking the problem on Baidu, it should be that gcc is not installed. Start entering the process of configuring the yum source and installing gcc
---------------------------yum configuration, gcc installation-- ---------------------
Since it is a virtual machine, you can mount the CD directly.
I will mount the CD here The download location is /dev/cdrom,
Use the command mount /dev/cdrom /mnt, and then check under /mnt, the contents of the CD appear.
Configure the yum source and rename the original repo file to ***.repo1 file. The content of my file is as follows, for reference only. If there are any questions, please contact Baidu. There are many answers, there is always one suitable for you:
[root@aaaddd software]# more /etc/yum.repos.d/dvd.repo [DVD] name=linux6.5baseurl=file:///mnt/Servergpgcheck=1enable=1[root@aaaddd software]#
Then execute yum clean to clear the yum cache
Execute yum makecache to create a new cache
Then execute yum install gcc and enter y when prompted to complete the installation. I encountered an error in this step, and the solution (from Baidu) is as follows:
warning: rpmts_HdrFromFdno: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY Public key for cpp-4.4.7-4.el6.i686.rpm is not installed [root@aaaddd Python-3.6.1]# [root@aaaddd Python-3.6.1]# [root@aaaddd Python-3.6.1]# [root@aaaddd Python-3.6.1]# rpm --import /etc/pki/rpm-gpg/RPM*[root@aaaddd Python-3.6.1]#
Then execute yum install gcc, and the installation is completed
-------------------------------Continue python installation----------------- --------------------------
Enter the python installation file directory and execute ./configure --prefix=/usr/local/ python3 (--prefix=/usr/local/python3 indicates the installation path, it is recommended to write it)
After the execution is completed, enter make &&make install
If there are still some situations such as missing packages during the process , just yum install. If you don’t know the name, you can add *
Finally: The most important thing is to add a soft link, otherwise python3 cannot be started [This is the disadvantage of specifying the path]
ln -s /usr/ local/python3/bin/python3 /usr/bin/python3
After this step is completed, you can enter python3 to start.
The above is the detailed content of How to install python under linux6.5 version. For more information, please follow other related articles on the PHP Chinese website!

Arraysarebetterforelement-wiseoperationsduetofasteraccessandoptimizedimplementations.1)Arrayshavecontiguousmemoryfordirectaccess,enhancingperformance.2)Listsareflexiblebutslowerduetopotentialdynamicresizing.3)Forlargedatasets,arrays,especiallywithlib

Mathematical operations of the entire array in NumPy can be efficiently implemented through vectorized operations. 1) Use simple operators such as addition (arr 2) to perform operations on arrays. 2) NumPy uses the underlying C language library, which improves the computing speed. 3) You can perform complex operations such as multiplication, division, and exponents. 4) Pay attention to broadcast operations to ensure that the array shape is compatible. 5) Using NumPy functions such as np.sum() can significantly improve performance.

In Python, there are two main methods for inserting elements into a list: 1) Using the insert(index, value) method, you can insert elements at the specified index, but inserting at the beginning of a large list is inefficient; 2) Using the append(value) method, add elements at the end of the list, which is highly efficient. For large lists, it is recommended to use append() or consider using deque or NumPy arrays to optimize performance.

TomakeaPythonscriptexecutableonbothUnixandWindows:1)Addashebangline(#!/usr/bin/envpython3)andusechmod xtomakeitexecutableonUnix.2)OnWindows,ensurePythonisinstalledandassociatedwith.pyfiles,oruseabatchfile(run.bat)torunthescript.

When encountering a "commandnotfound" error, the following points should be checked: 1. Confirm that the script exists and the path is correct; 2. Check file permissions and use chmod to add execution permissions if necessary; 3. Make sure the script interpreter is installed and in PATH; 4. Verify that the shebang line at the beginning of the script is correct. Doing so can effectively solve the script operation problem and ensure the coding process is smooth.

Arraysaregenerallymorememory-efficientthanlistsforstoringnumericaldataduetotheirfixed-sizenatureanddirectmemoryaccess.1)Arraysstoreelementsinacontiguousblock,reducingoverheadfrompointersormetadata.2)Lists,oftenimplementedasdynamicarraysorlinkedstruct

ToconvertaPythonlisttoanarray,usethearraymodule:1)Importthearraymodule,2)Createalist,3)Usearray(typecode,list)toconvertit,specifyingthetypecodelike'i'forintegers.Thisconversionoptimizesmemoryusageforhomogeneousdata,enhancingperformanceinnumericalcomp

Python lists can store different types of data. The example list contains integers, strings, floating point numbers, booleans, nested lists, and dictionaries. List flexibility is valuable in data processing and prototyping, but it needs to be used with caution to ensure the readability and maintainability of the code.


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

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

Dreamweaver Mac version
Visual web development tools

MinGW - Minimalist GNU for Windows
This project is in the process of being migrated to osdn.net/projects/mingw, you can continue to follow us there. MinGW: A native Windows port of the GNU Compiler Collection (GCC), freely distributable import libraries and header files for building native Windows applications; includes extensions to the MSVC runtime to support C99 functionality. All MinGW software can run on 64-bit Windows platforms.
