In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly introduces how centos7 upgrades python3.6, installs ipython6.4 and pip. It is very detailed and has certain reference value. Friends who are interested must finish reading it.
The system environment is centos7, which requires the use of python3 and interactive window ipython
1. Upgrade python3.6
1. Check the version of python that comes with the system.
# python-version
(the system comes with a lower python version of 2.7)
2. Download python3.6
Download address: https://www.python.org/ftp/python/
(there are several versions of python, which can be downloaded according to your own needs. In this example, download python-3.6.4)
3. Decompress python-3.6.4
Note: it is best to extract it to the / usr/local/ directory
# tar zxvf Python-3.6.4.tgz-C / usr/local/
4. Go to / usr/local/Python-3.6.4 folder
# cd / usr/local/Python-3.6.4
5. Compile and install
Note: if you execute the configure file directly, you will be prompted to add the-- enable-optimizations option
#. / configure-prefix=/usr/local/Python-3.6.4-enable-optimizations & & make & & make install
(it will take about 10 minutes to extract the installation process. Wait patiently)
6. Change the soft connection to make the system use python3 by default
① backs up the original file first
# mv python python.bak
② establishes a connection
# ln-s / usr/local/Python-3.6.4/bin/python3.6 / usr/bin/python
7. Testing
# python-version
Upgrade successful!
8. Error handling
After the python compilation and installation steps are completed, the following error may occur:
Zipimport.ZipImportError:can't decompress data:zlib not available
Make: * * [install] Error 1
It shows that the system lacks zlib packages, which can be installed through the yum command, and there are also cases where other packages are missing on the Internet, according to personal system configuration.
# yum install zlib*
It is also found that an error has been reported as follows:
After being taught by all kinds of du Niang, it is found that the yum command uses the python2.7 command that comes with the system, and can only change the header of the / usr/bin/yum file, changing #! / usr/bin/python to #! / usr/bin/python2.7.
Another place / usr/libexec/urlgrabber-ext-down needs to be modified for the same reason as yum (ps: I didn't encounter this error during the actual installation, but I changed it in order not to cause myself any trouble)
# yum install zlib*
Installation succeeded
Then re-execute make install in the compiled directory of python3.6
# cd / usr/local/Python-3.6.4
# make install
Second, install ipython6.4
There are two ways to install ipython: using python and ipython source code, and using the pip command to install
1. Source code installation
① download ipython
Download address: https://files.pythonhosted.org/packages/ee/01/2a85cd07f5a43fa2e86d60001c213647252662d44a0c2e3d69471a058f1b/ipython-6.4.0.tar.gz
② decompression
# tar zxvf ipython-6.4.0.tar.gz
③ enters the decompressed file
# cd ipython-6.4.0
④ installation
# python setup.py install
⑤ test installation
# ipython
⑥ error handling
If you find the following error during the test:
Bash:ipython:command not found
If there is a problem with the setting of the environment variable, run the following command:
# alias ipython='python-m IPython'
(this command can only solve temporary problems, and the same error will be reported when the client is disconnected)
The ultimate solution is to find the location of the ipython command and soft connect to the / usr/bin directory. The native machine is as follows:
# ln-s / usr/local/Python-3.6.4/bin/ipython3 / usr/bin/ipython
Test error missing package:
Can be installed using the pip command
# pip install pickleshare
Due to the large number of dependent packages, ipython can be tested several times until you can enter the ipython command line to use it.
2. Pip command installation
# pip install ipython
(the pip command is easy to install, but the version of ipython is not under your control. If you want to use the latest version, it is better to install it manually.)
III. Use of pip
In fact, after installing python3.6, the system has already installed pip3, and the command path is in the bin directory of the python path.
At this point, only a soft connection is needed to make the system use pip by default.
# ln-s / usr/local/Python-3.6.4/bin/pip3 / usr/bin/pip
The above is all the contents of the article "how centos7 upgrades python3.6, installs ipython6.4 and pip". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.