密码保护:卫星运行轨道常用运算方法

此内容受密码保护。如需查阅,请在下列字段中输入您的密码。

发表在 space | 密码保护:卫星运行轨道常用运算方法已关闭评论

NTP Servers | NTP 授时服务

NTP,全称Network Time Protocol ,即网络时间协议。通过NTP服务器可以同步电脑、服务器的时间。Windows自带的NTP服务器time.windows.com在海外,经常网络卡连不上,导致时间不同步,还是有必要换一下Windows电脑的NTP服务器。

国内推荐使用阿里巴巴、腾讯的公共NTP服务器。

阿里巴巴公共NTP

官网:https://help.aliyun.com/document_detail/92704.html

ntp.aliyun.com

ntp1.aliyun.com

ntp2.aliyun.com

ntp3.aliyun.com

ntp4.aliyun.com

ntp5.aliyun.com

ntp6.aliyun.com

ntp7.aliyun.com

腾讯公共NTP

官网:https://cloud.tencent.com/document/product/213/30392

time1.cloud.tencent.com

time2.cloud.tencent.com

time3.cloud.tencent.com

time4.cloud.tencent.com

time5.cloud.tencent.com

谷歌Google公共NTP

谷歌推出的公共NTP服务器,节点都在海外,在中国使用并不理想

官网:https://developers.google.com/time

time1.google.com

time2.google.com

time3.google.com

time4.google.com

国家授时中心

官网:http://www.ntsc.ac.cn/

ntp.ntsc.ac.cn

ntp.org

权威的公共NTP服务器了,NTP服务器多是第三方提供,服务器是海外,国内并不推荐,查查海外NTP服务器还是挺好的。

中国公共NTP服务器,https://www.pool.ntp.org/zone/cn

全球公共NTP服务器,https://www.ntppool.org/zone/@

官网:http://ntp.org/

0.cn.pool.ntp.org

1.cn.pool.ntp.org

2.cn.pool.ntp.org

3.cn.pool.ntp.org

微软公共NTP服务器    Windows公共NTP

time.windows.com

美国标准技术研究院NTP(NIST NTP Server)

官网:https://tf.nist.gov/tf-cgi/servers.cgi

time.nist.gov

 

.

发表在 info | NTP Servers | NTP 授时服务已关闭评论

欧空局开源大量卫星应用软件(Open Source Software Resources for Space Downstream Applications)

信息来源于网络,未经证实,仅供参考:

信息源:

https://www.esa.int/Enabling_Support/Space_Engineering_Technology/Radio_Frequency_Systems/Open_Source_Software_Resources_for_Space_Downstream_Applications

 

This page provides a list of open source software resources for developing space downstream applications, in the following categories:

A short description of each entry appears when hovering over the name (left column).

Disclaimer: the information is provided as is without any guarantee, and ESA cannot be liable for any views expressed in this webpage as well as in the linked websites.

Positioning & Navigation (including GNSS)

 

Name Author/Developer Format Licence
gLAB Universitat Politecnica de Catalunya (UPC) Source and Executable for Linux, Windows and macOS Apache, GPL and LGPL
GNSS-SDR CTTC Source code and libs for Linux Debian, macOS. Runs on GNU Radio GPL v3
GPS-SDR-SIM Takuji Ebinuma Source code MIT
GNSS-SDRLIB Taro Suzuki Source and Executable for Windows GPL v2
RTKLIB Tomoji Takasu Source and Executable for Windows BSD-2-Clause
ARAMIS ip-solutions Executable in Windows Free for academic use
goGPS Geomatics Laboratory of Politecnico di Milano, Como campus (Italy) Source code for Matlab 2016a+ and Java GPL v3
TEQC UNAVCO Executable (Windows, macOS, Linux…). Supports RINEX and BINEX formats
Online Positioning User Service (OPUS) NOAA Executable online
CSRS-PPP Canadian Geodetic Survey (CGS) Executable online or as a desktop application. Supports RINEX files Open Government Licence - Canada
JAG3D (Java Applied Geodesy 3D) Steinbeis Transfer Centre Applied Geodesy Java GPL v3
Android Raw GNSS Measurement Google GnssLogger source code in Matlab, but you don’t need Matlab to use it Apache v2.0
GPSTk Applied Research Laboratories at the University of Texas at Austin Source and Executable (Unix, Windows, macOS) LGPL v3
BKG Ntrip Software Federal Agency for Cartography and Geodesy (BKG) Source and Executable for Linux, Solaris, Windows and macOS GPU

Earth Observation software and data (including geographic information systems)

 

Name Author/Developer Format Licence
OpenGTS GeoTelematic Solutions, Inc. Java Apache v2.0
Viking GPS data editor and analyzer Various authors Executable (written mostly in C) GPL v2
OpenStreetMap OpenStreetMap Community Data online ODbL
GeoServer Open Source Geospatial Foundation Supports WFS, WMS and WCS standards GPL v2
Orfeo ToolBox (OTB) CNES Source and Executable (Linux, Windows, macOS) Apache v2.0
PolSARpro ESA / IETR Executable for Windows and Linux GPL v2
SNAP and Sentinel Toolboxes ESA Science Toolbox Exploitation Platform (STEP) Source and Executable (Windows, macOS, Unix) GPL v3
DIMITRI - Database for Imaging Multi-spectral Instruments and Tools for Radiometric Intercomparison ESA, ARGANS, Magellium Source code, compatible with Linux, Windows and macOS SLA
ADAM API Toolkit Noveltis Executable online Free online service after registration
TauDEM - Terrain Analysis Using Digital Elevation Models Utah State University, USA Source code, command line executable and ArcGIS toolbox GUI GPL v3
GRASS GIS - Geographic Resources Analysis Support System GRASS GIS developers community Stand-alone application or backend for other software packages GPL v2
SAGA - System for automated Geoscientific Analyses University of Hamburg, Germany Coded in C++. Source code and GUI executable for Windows and Linux GPL v2
Whitebox GAT - Geospatial Analysis Tools University of Guelph, Canada Executable (Windows, Linux, macOS) GPL v3
MACCS/MAJA CNES and CESBIO Language: C++, Python and Cmake. OS:Linux RedHat 6+, CENTOS 6+ Ubuntu 12.04+ CNES
Sen2Agri system ESA Linux GPL v3
Open Layers Open Layers API and codes BSD-2-Clause
GeoTrellis LocationTech, Azavea Library for Linux Apache v2.0
GeoMesa LocationTech, CCRi Spatio-temporal index for Linux Apache v2.0
gvSIG Desktop gvSIG Association Platforms: Linux / Unix, macOSX, Windows, Android. Languages: Java, Python, Groovy, Renjin, Scala GPL
QGIS QGIS Community Linux, Unix, macOS and Windows GPL
Get3Di GeoCue Group Executable online Free up to 100 MB/month
AHN-viewer ArcGIS Executable online Free online service
ESA Online Dissemination ESA Data online
GeoNames GeoNames Webservice and database exports CC BY 4.0
HydroSheds WWF Vector and raster data HydroSHEDS
SRTM Data CGIAR Consortium for Spatial Information ACII and GeoTIFF
GSAC UNAVCO Java. For Linux and Unix

Satellite Communications

 

Name Author/Developer Format Licence
Network Simulator 3 (ns-3) ns-3 project Source code GPL v2
Satellite Network Simulator (SNS3) Jani Puttonen, Janne Kurjenniemi (Magister Solutions), ESA, CNES Source code GPL v3
Leandvb pabr@pabr.org Executable code GPL v3
gr-dvbs2 Ron Economos Source code, also part of GNU Radio GPL v3
gr-dvbs2rx Ahmet Inan, Ron Economos Source code GPL v3
ROHC library CNES, TAS, Viveris Technologies Source code for Linux, Windows and macOS LGPL v2.1+
OpenLTE Ben Wojtowicz, Dennis M Senyonjo Source code in C++ and Python AGPL v3
OAI Radio Access Network (OAI-RAN) Various Source code OAI 5G Public License v1.1
OAI Core Network (OAI-CN) EURECOM, OPEN CELLS Source code Apache v2.0
free5GC National Chiao Tung University (NCTU) and other contributors Source code Apache v2.0
ChirpStack Orne Brocaar Source code MIT
STRF Cees Bassa Source code for Linux and GNU Radio GPL v3

Other resources for open source, SDR, standards, AI, cloud computing

 

Name Author/Developer Format Licence
GNU Radio GNU Radio project Source code for Linux, macOS GPL v3
MongoDB MongoDB Inc. Source and Executable (Windows, Linux, macOS, Solaris, FreeBSD) Server Side Public License
Apache Hadoop Apache Software Foundation Source code download Apache v2.0
Apache Storm Apache Software Foundation Implemented in Java, can be used with any programming language Apache v2.0
Apache Spark Apache Software Foundation Standalone cluster mode, on EC2, on Hadoop YARN, on Mesos, or on Kubernetes. Apache v2.0
Tensor Flow Google Collection of workflows Apache v2.0
Docker Engine Docker Executable for Linux, Windows, macOS Apache v2.0
OpenStack OpenStack Executable Apache v2.0
Rasdaman Supervised by Jacobs University, in incubation by the OSGeo fundation Download of packages that work on distributions with gcc 4.8+, Java 7+ GPL v3
SciDB Community Edition Paradigm4 Software that can run on existing hardware or in the cloud GPL v3
Theano Several authors Python library BSD-3-Clause
Deeplearning 4j Eclipse Deeplearning4j Development Team Libraries Apache v2.0
Google Earth Engine Google The Earth Engine (EE) API is available in Python and JavaScript. Google Earth Engine License
Microsoft CNTK Microsoft Toolkit compatible with Linux and Windows MIT
Keras François Chollet and various Python libraries MIT
Scikit-learn David Cournapeau and various Python libraries for Linux, macOS and Windows BSD-3-Clause
tslearn Romain Tavenard Python package BSD-3-Clause
Boto3 Amazon Web Services (AWS) Python libraries Apache v2.0
PyTorch Facebook AI research group Python libraries for Linux, macOS and Windows BSD-3-Clause
OpenCV Intel C++ library for Windows, Linux, macOS, FreeBSD, NetBSD, OpenBSD... BSD-3-Clause
pandas Wes McKinney and various Python library BSD-3-Clause
NVIDIA DIGITS NVIDIA Executable Free after joining the NVIDIA Developer Program
XGBoost XGBoost community Library, for Python, R, Java, Scala, C++ and more. Runs on single machine, Hadoop, Spark, Flink and DataFlow. Apache v2.0
GDAL GDAL community Source and binaries for Windows, Debian and containers MIT
Open Data Cube Open Data Cube Collection of software base on Python library Apache v2.0
R Project R foundation It compiles and runs on a wide variety of UNIX platforms, Windows and macOS. GPL v2
Project Jupyter Jupyter Community Web application, executable online and for downloading. BSD-3-Clause
Apache NiFi Apache Software Foundation Executable Apache v2.0
Apache Kafka Apache Software Foundation Executable Apache v2.0
Kubernetes Kubernetes Container CC BY 4.0
NodeJS Node.js is a trademark of Joyent, Inc For Windows, macOS and Linux. MIT
Leaflet Vladimir Agafonkin and others JavaScript library CC BY 4.0
Gapminder Tools Offline Gapminder For Windows, macOS and Linux CC BY 4.0
Elasticsearch and Kibana Amazon Web Services (AWS) Docker images, RPM files, and Debian files Apache v2.0
Open Geospatial Consortium (OGC) OGC members Standards Open standards
GeoJSON Internet Engineering Task Force (IETF), in conjunction with the original specification authors. Format Open standards
gr-opssat Arctic Space Technologies and ESA Module for GNU Radio GPL v3
NanoSat MO Framework Graz University of Technology and ESA Java source code ESA-PL v2

Open source catalogues and repositories

 

Name Application domain Description
European Space Software Repository Multiple ESA informational web portal created to promote reuse of Software - including Open Source Software (OSS) - and to provide all parties involved in the European Space software development (in particular SMEs) with access to results of previous investments. Registration available to ESA member states.
ACT Open Source projects & tools Multiple ESA Advanced Concepts Team (ACT) resources for Open Sources projects and tools. Together with the introduction of the github and the gitlab dedicated channels for the European Space Agency and the of specific programmes such as SOCIS (the ESA summer of code in space), the ACT, over the years, developed and is now maintaining a number of open source projects that are put at the service of a wider community.
CNES Software Catalogue Multiple The "Centre National d'Études Spatiales" has produced various software for the space projects. This software covers a broad range of topics, from normalization to space dynamics and simulation tools. Some were developed to support CNES internal needs and are now available to the public.
RTL-SDR Software Signal processing RTL-SDR is a USB dongle based on the RTL2832U chipset, for which many SDR software have been developped for different applications (not only satellite)
ION GNSS SDR Standard GNSS The GNSS SDR Metadata Standard defines parameters and schema to express the contents of SDR sample data files. The standard is designed to promote the interoperability of GNSS SDR data collection systems and processors.
NOAA collection of GPS software GNSS Site is running since 1999. The main purpose of this site is to provide a means for distributing the source code and algorithms discussed in the GPS Toolbox column.
UNAVCO software GNSS Web-based data visualization and mapping tools provide users with the ability to view post–processed data while web-based geodetic utilities provide ancillary information.
Terrasigna Pathfinder Earth observation References more than 350 open source software for processing of Earth Observation data, with categorisation and graph representation
ESA Newcomers EO Guide Earth observation Guide to help non experts in providing a starting point in the decision process for selecting an appropriate Earth observation (EO) solution. Includes links to public and commercial EO data providers. See also https://business.esa.int/sites/default/files/Where_to_access_EO_data_AS.pdf
ESA Earth online portal Earth observation List of software tools supported by ESA for Earth Observation
ESA STEP Earth observation ESA is developing  free open source toolboxes for the scientific exploitation of Earth Observation missions under the the Scientific Exploitation of Operational Missions (SEOM)  programme element.  STEP is the ESA community platform for accessing the software and its documentation, communicating with the developers, dialoguing within the science community, promoting results and achievements as well as providing tutorials and material for training scientists using the Toolboxes.
ESA Thematic Exploitation Platforms (TEPs) Earth observation TEPs are collaborative, virtual work environments providing access to EO data and tools, processors, and information and communication technology resources, required to work with them, through one coherent interface. Topics: Coastal, Forestry, Hydrology, Geohazards, Polar, Urban themes, Food Security
Copernicus Open Access Hub Earth observation The Copernicus Open Access Hub (previously known as Sentinels Scientific Data Hub) provides complete, free and open access to Sentinel-1Sentinel-2Sentinel-3 and Sentinel-5P user products, starting from the In-Orbit Commissioning Review (IOCR). Sentinel Data are also available via the Copernicus Data and Information Access Services (DIAS) through several platforms.
DIAS -Copernicus Data & Information Access Services Earth observation DIAS online platforms allow users to discover, manipulate, process and download Copernicus Sentinel data and information products from Copernicus’ six operational services, together with cloud-based tools (open source and/or on a pay-per-use basis).
Sentinel Hub Earth observation Sentinel Hub is operated by Sinergise - a GIS IT company with more than 10 years of experience in working with spatial data.
Different applications are available online.
The satellite imagery distribution service is based on Sinergise's cloud GIS platform - Geopedia - web based spatial management solution, which is being used by more than one million users annualy and is therefore perfectly suitable for large scale spatial deployments.
Earth System Data Lab (ESDL) Earth observation The Earth System Data Lab is a multi-variate data set of essential Earth System variables on a common grid and sharing a common data model.
USGS Earth Explorer Earth observation U.S. Geological Survey -search catalogue of satellite and aerial imagery.
Alaska Satellite Facility (ASF) Earth observation The ASF facility is part of the Geophysical Institute of the University of Alaska Fairbanks. ASF downlinks, processes, archives, and distributes remote-sensing data to scientific users around the world.
OSGEO Earth observation The Open Source Geospatial Foundation (OSGeo) is a not-for-profit organization whose mission is to foster global adoption of open geospatial technology by being an inclusive software foundation devoted to an open philosophy and participatory community driven development.
OpenDEM Earth observation List of free Digital Elevation Models. This project will focus on free high resolution datasets with a spatial resolution of 30 meters and below on county/state scale.
On-Line Geodesy Resources Earth observation A personal collection of geodesy and related resources on the Web. Created by Mike Craymer.
SDR makerspace Satellite communications SDRmaker.space, created by Libre Space Foundation under an ESA ARTES project, is an activity framework that aims to bring together makers, open-source hackers, radio amateurs, researchers and academia from all over Greece. The website lists a number of SDR projects for satellite communications, including TT&C.
CGRAN Satellite communications The Comprehensive GNU Radio Archive Network (CGRAN) is a free open source repository for 3rd party GNU Radio applications (a.k.a Out Of Tree Modules) that are not officially supported by the GNU Radio project. Licensed under CC BY 4.0. For Linux OS.

 

Feedback: for proposing new entries or updating information, please send an email to nicolas.girault @ esa.int.

 

.

发表在 space | 欧空局开源大量卫星应用软件(Open Source Software Resources for Space Downstream Applications)已关闭评论

密码保护:太空目标和卫星轨道根数

此内容受密码保护。如需查阅,请在下列字段中输入您的密码。

发表在 space | 密码保护:太空目标和卫星轨道根数已关闭评论

HBase

HBase结构

  

发表在 storage | HBase已关闭评论

Spring schedule

一、使用@Schedule注解方式实现定时任务

1、使用maven创建spring项目,schedule在spring-context.jar的包下边,因此需要导入与之相关的包,如下:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>4.1.7.RELEASE</version>
</dependency>

2、配置Spring.xml,选择http://www.springframework.org/schema/task

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns:task="http://www.springframework.org/schema/task"
    xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/task
http://www.springframework.org/schema/task/spring-task-3.1.xsd">
 
    <!-- 开启定时任务 -->
    <task:annotation-driven />
</beans>

3、编写定时器类,需要在类上加入@Component注解加入Spring容器,在方法上加入Cron表达式

package scheduleTest;
 
import java.text.SimpleDateFormat;
import java.util.Date;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
 
/**
 * spring schedule
 * 
 * @author Su
 *
 */
@Component
public class ScheduleTest {
 
    @Scheduled(cron = "0/30 * * * * ?")
    public void scheduleTest() {
        //每30秒执行一次
        //相关逻辑操作,如关闭订单,设置定时关单的时间(建议设置在配置文件中)
        //查询订单表的创建时间进行相关处理
    }
}

4、在web.xml中配置Spring上下文监听器

<listener>
    <listener-class>org.springframework.web.context.
ContextLoaderListener</listener-class>
</listener>

二、对Spring Schedule Cron表达式的理解

Cron表达式使用格式

 

Seconds Minutes Hours Day Month Week [Year]
[年
可选]
字段名 允许的值 允许的特殊字符
0-59 , - * /
0-59 , - * /
小时 0-23 , - * /
月内日期 1-32 , - * ? / L W C
1-12 或 JAN-DEC , - * /
周内日期 1-7 或 SUN-SAT , - * ? / L C #
留空,1980-2099 , - * /

每个符号代表的含义:

*:匹配该域的任意值;如*用在分所在的域,表示每分钟都会触发事件。
?:匹配该域的任意值。月份的天河周的天互相冲突,必须将其中一个设置为?
-:匹配一个特定的范围值;如时所在的域的值是10-12,表示10、11、12点的时候会触发事件。
,:匹配多个指定的值;如周所在的域的值是2,4,6,表示在周一、周三、周五就会触发事件(1表示周日,2表示周一,3表示周二,以此类推,7表示周六)。
/:左边是开始触发时间,右边是每隔固定时间触发一次事件,如秒所在的域的值是5/15,表示5秒、20秒、35秒、50秒的时候都触发一次事件。
L:last,最后的意思,如果是用在天这个域,表示月的最后一天,如果是用在周所在的域,如6L,表示某个月最后一个周五。(外国周日是星耀日,周一是月耀日,一周的开始是周日,所以1L=周日,6L=周五。)
W:weekday,工作日的意思。如天所在的域的值是15W,表示本月15日最近的工作日,如果15日是周六,触发器将触发上14日周五。如果15日是周日,触发器将触发16日周一。如果15日不是周六或周日,而是周一至周五的某一个,那么它就在15日当天触发事件。
#:用来指定每个月的第几个星期几,如6#3表示某个月的第三个星期五

举些例子:

表达式 含义

“0 0 12 * * ?” 每天12:00触发事件
“0 15 10 ? * *” 每天10:15触发事件
“0 15 10 * * ?” 每天10:15触发事件
“0 15 10 * * ? *” 每天10:15触发事件
“0 15 10 * * ? 2005″ 2005年的每天10:15触发事件
“0 * 14 * * ?” 每天14点开始触发,每分钟触发一次,14:59分结束
“0 0/5 14 * * ?” 每天14点开始触发到14:59分结束的每5分钟触发一次事件
“0 0/5 14,18 * * ?” 每天14点开始到14:59期间和18点到18:59期间的每5分钟触发一次事件
“0 0-5 14 * * ?” 每天14点到14:05期间的每1分钟触发一次事件
“0 10,44 14 ? 3 WED” 每年3月的星期三的14:10和14:44触发一次事件
“0 15 10 ? * MON-FRI” 周一至周五的10:15触发一次事件
“0 15 10 15 * ?” 每月15日10:15触发一次事件
“0 15 10 L * ?” 每月最后一日的10:15触发一次事件
“0 15 10 ? * 6L” 每月的最后一个星期五10:15触发一次事件
“0 15 10 ? * 6L 2002-2005″ 2002年至2005年的每月的最后一个星期五10:15触发一次事件
“0 15 10 ? * 6#3″ 每月的第三个星期五10:15触发一次事件

————————————————

本文为网摘文章,原文为以下:
版权声明:本文为CSDN博主「苏启豪」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/a2267378/article/details/82019901

 

.

发表在 java | Spring schedule已关闭评论

kvm qcow2 extend

直接扩展现有qcow2格式磁盘大小的方法

注: 对应虚拟机的分区为vda,虚拟机系统为centos7

1. 查看磁盘文件信息,进行扩展

[root@vp-01 export]# qemu-img info test.qcow2
image: test.qcow2
file format: qcow2
virtual size: 20G (21474836480 bytes)
disk size: 2.1G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
新增磁盘容量大小20G
[root@vp-01 export]# qemu-img resize test.qcow2 +20G
Image resized.
[root@vp-01 export]# qemu-img info test.qcow2
image: test.qcow2
file format: qcow2
virtual size: 40G (42949672960 bytes)
disk size: 2.1G
cluster_size: 65536
Format specific information:
compat: 1.1
lazy refcounts: false
refcount bits: 16
corrupt: false
对比后发现磁盘已经由原来的20G变为40G了

2. 启动虚拟机查看磁盘信息

[root@172-16-20-171 ~]#
[root@172-16-20-171 ~]# df -Th
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 18G 1.9G 16G 11% /
devtmpfs devtmpfs 487M 0 487M 0% /dev
tmpfs tmpfs 497M 0 497M 0% /dev/shm
tmpfs tmpfs 497M 6.6M 490M 2% /run
tmpfs tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/vda1 xfs 497M 130M 368M 27% /boot
tmpfs tmpfs 100M 0 100M 0% /run/user/0
[root@172-16-20-171 ~]#

3. 开始分区

[root@172-16-20-171 ~]#
[root@172-16-20-171 ~]# fdisk /dev/vda
欢迎使用 fdisk (util-linux 2.23.2)。

更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。

命令(输入 m 获取帮助):p

磁盘 /dev/vda:42.9 GB, 42949672960 字节,83886080 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x0003f814

设备 Boot Start End Blocks Id System
/dev/vda1 * 2048 1026047 512000 83 Linux
/dev/vda2 1026048 41943039 20458496 8e Linux LVM

命令(输入 m 获取帮助):n
Partition type:
p primary (2 primary, 0 extended, 2 free)
e extended
Select (default p): p
分区号 (3,4,默认 3):3
起始 扇区 (41943040-83886079,默认为 41943040):
将使用默认值 41943040
Last 扇区, +扇区 or +size{K,M,G} (41943040-83886079,默认为 83886079):
将使用默认值 83886079
分区 3 已设置为 Linux 类型,大小设为 20 GiB

命令(输入 m 获取帮助):t
分区号 (1-3,默认 3):3
Hex 代码(输入 L 列出所有代码):8e
已将分区“Linux”的类型更改为“Linux LVM”

命令(输入 m 获取帮助):w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
正在同步磁盘。
[root@172-16-20-171 ~]#
此步骤当中,最终要的地方就是 分配新的区需要修改分区的system id,将分区类型改为LVM(Hex代码为8e)。

4. 创建物理卷、加入卷组、扩展逻辑卷

创建物理卷
[root@172-16-20-171 ~]# pvcreate /dev/vda3 (分区以后要重启或者执行partprobe,就不会出现Device /dev/sda3 not found (or ignored by filtering)提示)
Physical volume “/dev/vda3” successfully created
[root@172-16-20-171 ~]# pvs
PV VG Fmt Attr PSize PFree
/dev/vda2 centos lvm2 a-- 19.51g 40.00m
/dev/vda3 lvm2 — 20.00g 20.00g
加入卷组
[root@172-16-20-171 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 1 2 0 wz–n- 19.51g 40.00m
[root@172-16-20-171 ~]# vgextend centos /dev/vda3
Volume group “centos” successfully extended
[root@172-16-20-171 ~]# vgs
VG #PV #LV #SN Attr VSize VFree
centos 2 2 0 wz–n- 39.50g 20.04g
扩展逻辑卷
[root@172-16-20-171 ~]# lvextend -l +100%FREE /dev/centos/root
Size of logical volume centos/root changed from 17.47 GiB (4472 extents) to 37.50 GiB (9601 extents).
Logical volume root successfully resized.
[root@172-16-20-171 ~]# resize2fs /dev/centos/root
resize2fs 1.42.9 (28-Dec-2013)
resize2fs: Bad magic number in super-block 当尝试打开 /dev/centos/root 时
找不到有效的文件系统超级块.
发现报错,分析原因是因为使用dh -T查看系统分区类型为xfs
因此直接使用xfs_growfs扩展即可
[root@172-16-20-171 ~]# xfs_growfs /dev/centos/root
meta-data=/dev/mapper/centos-root isize=256 agcount=4, agsize=1144832 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0
data = bsize=4096 blocks=4579328, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=0
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 4579328 to 9831424

5. 确认磁盘是否增长

[root@172-16-20-171 ~]# df -Th
文件系统 类型 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root xfs 38G 1.9G 36G 6% /
devtmpfs devtmpfs 487M 0 487M 0% /dev
tmpfs tmpfs 497M 0 497M 0% /dev/shm
tmpfs tmpfs 497M 6.6M 490M 2% /run
tmpfs tmpfs 497M 0 497M 0% /sys/fs/cgroup
/dev/vda1 xfs 497M 130M 368M 27% /boot
tmpfs tmpfs 100M 0 100M 0% /run/user/0
发现系统容量已经由20G扩展为40G

 

References:

https://www.cnblogs.com/zzc-blog/p/14121695.html

 

发表在 linux | kvm qcow2 extend已关闭评论

Python logging

Example 1

import logging

LOG_FORMAT = '%(asctime)s - %(name)s - %(levelname)s - %(message)s'
logging.basicConfig(format=LOG_FORMAT)

logger.info('info log')
logger.error('error log')
logger.warn('warn log')
logger.debug('debug log')

Example 2

import logging

LOG_FORMAT = '%(asctime)s %(clientip)-15s %(user)-8s %(message)s'
logging.basicConfig(format=LOG_FORMAT)

logger = logging.getLogger('tcpserver')
logger.warning('Protocol problem: %s', 'connection reset', extra=d)

Example3

import logging
# create logger
logger = logging.getLogger('simple_example')
logger.setLevel(logging.DEBUG)

# create console handler and set level to debug
ch = logging.StreamHandler()
ch.setLevel(logging.DEBUG)

# create formatter
formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')

# add formatter to ch
ch.setFormatter(formatter)

# add ch to logger
logger.addHandler(ch)

# 'application' code
logger.debug('debug message')
logger.info('info message')
logger.warning('warn message')
logger.error('error message')
logger.critical('critical message')

 

References:

https://baijiahao.baidu.com/s?id=1663188765325528537&wfr=spider&for=pc

.

发表在 python | Python logging已关闭评论

jdk version / jdk 版本对照

 

 

 

.

发表在 java | jdk version / jdk 版本对照已关闭评论

log4j.xml / logback.xml

一、Log4j2介绍

  Log4j 2.x版本不再支持像1.x中的.properties后缀的文件配置方式,2.x版本配置文件后缀名只能为".xml",".json"或者".jsn"。

  • 配置文件的格式:log2j配置文件可以是xml格式的,也可以是json格式的。
  • 配置文件的位置:log4j2默认会在classpath目录下寻找log4j2.xml、log4j.json、log4j.jsn等名称的文件。

系统选择配置文件的优先级(从先到后)如下:

  1. .classpath下的名为log4j2-test.json 或者log4j2-test.jsn的文件.
  2. .classpath下的名为log4j2-test.xml的文件.
  3. .classpath下名为log4j2.json 或者log4j2.jsn的文件.
  4. .classpath下名为log4j2.xml的文件.

一般默认使用log4j2.xml.

二、配置文件节点解析

(1).根节点

  • Configuration有两个属性:status和monitorinterval,有两个子节点:Appenders和Loggers(表明可以定义多个Appender和Logger)。
  • status用来指定log4j本身的打印日志的级别.
  • monitorinterval用于指定log4j自动重新配置的监测间隔时间,单位是s,最小是5s.

(2).Appenders节点,

常见的有三种子节点:Console、RollingFile、File.

  • Console节点用来定义输出到控制台的Appender.
  • name:指定Appender的名字.
  • target:SYSTEM_OUT 或 SYSTEM_ERR,一般只设置默认:SYSTEM_OUT.
  • Patt ernLayout:输出格式,不设置默认为:%m%n.
  •   File节点用来定义输出到指定位置的文件的Appender.
  •     name:指定Appender的名字.
  •     fileName:指定输出日志的目的文件带全路径的文件名.
  •     PatternLayout:输出格式,不设置默认为:%m%n.
  •   RollingFile节点用来定义超过指定大小自动删除旧的创建新的的Appender.
  •     name:指定Appender的名字.
  •     fileName:指定输出日志的目的文件带全路径的文件名.
  •     PatternLayout:输出格式,不设置默认为:%m%n.
  •     filePattern:指定新建日志文件的名称格式.
  •     Policies:指定滚动日志的策略,就是什么时候进行新建日志文件输出日志.
  •     TimeBasedTriggeringPolicy:Policies子节点,基于时间的滚动策略,interval属性用来指定多久滚动一次,默认是1 hour。modulate=true用来调整时间:比如现在是早上3am,interval是4,那么第一次滚动是在4am,接着是8am,12am...而不是7am.
  •     SizeBasedTriggeringPolicy:Policies子节点,基于指定文件大小的滚动策略,size属性用来定义每个日志文件的大小.
  •     DefaultRolloverStrategy:用来指定同一个文件夹下最多有几个日志文件时开始删除最旧的,创建新的(通过max属性)。
  • ThresholdFilter属性:onMatch表示匹配设定的日志级别后是DENY还是ACCEPT,onMismatch表示不匹配设定的日志级别是DENY还是ACCEPT还是NEUTRAL

(3).Loggers节点

常见的有两种:Root和Logger.

  • Root节点用来指定项目的根日志,如果没有单独指定Logger,那么就会默认使用该Root日志输出
  • level:日志输出级别,共有8个级别,按照从低到高为:All < Trace < Debug < Info < Warn < Error < Fatal < OFF.
  • Logger节点用来单独指定日志的形式,比如要为指定包下的class指定不同的日志级别等。
  •     level:日志输出级别,共有8个级别,按照从低到高为:All < Trace < Debug < Info < Warn < Error < Fatal < OFF.
  •     name:用来指定该Logger所适用的类或者类所在的包全路径,继承自Root节点.
  •     AppenderRef:Logger的子节点,用来指定该日志输出到哪个Appender,如果没有指定,就会默认继承自Root.如果指定了,那么会在指定的这个Appender和Root的Appender中都会输出,此时我们可以设置Logger的additivity="false"只在自定义的Appender中进行输出。

(4).关于日志level.

  •   共有8个级别,按照从低到高为:All < Trace < Debug < Info < Warn < Error < Fatal < OFF.
  •   All:最低等级的,用于打开所有日志记录.
  •   Trace:是追踪,就是程序推进以下,你就可以写个trace输出,所以trace应该会特别多,不过没关系,我们可以设置最低日志级别不让他输出.
  •   Debug:指出细粒度信息事件对调试应用程序是非常有帮助的.
  •   Info:消息在粗粒度级别上突出强调应用程序的运行过程.
  •   Warn:输出警告及warn以下级别的日志.
  •   Error:输出错误信息日志.
  •   Fatal:输出每个严重的错误事件将会导致应用程序的退出的日志.
  •   OFF:最高等级的,用于关闭所有日志记录.
  •   程序会打印高于或等于所设置级别的日志,设置的日志等级越高,打印出来的日志就越少。
  • 配置参数解释
  • %d{HH:mm:ss.SSS} 表示输出到毫秒的时间
  • %t 输出当前线程名称
%-5level 输出日志级别,-5表示左对齐并且固定输出5个字符,如果不足在右边补0

三、Maven依赖

<dependencies>  
        <groupId>org.apache.logging.log4j</groupId>  
        <artifactId>log4j-api</artifactId>  
        <version>2.5</version>  
    </dependency>  
    <dependency>  
        <groupId>org.apache.logging.log4j</groupId>  
        <artifactId>log4j-core</artifactId>  
        <version>2.5</version>  
    </dependency> 
</dependencies>

使用SLF4J + LOG4J配置时,可以简化到仅一个依赖:

<dependency>
    <groupId>org.apache.logging.log4j</groupId>
    <artifactId>log4j-slf4j-impl</artifactId>
    <version>2.20.0</version>
</dependency>

使用SLF4J + LOGBACK配置时,可以简化到仅一个依赖:

<dependency>
    <groupId>ch.qos.logback</groupId>
    <artifactId>logback-classic</artifactId>
<!--    <version>1.3.6</version> -->
    <version>1.2.11</version>
</dependency>

注意选用1.3.x/1.2.x版本,不要使用1.4.0, 1.4.x 版本出现UnsupportedClassVersionError异常。
目前 Logback 发布了 1.3 & 1.4 两个版本,logback 1.3.x 支持 Java EE 版本,而 logback 1.4.x 支持 Jakarta EE,两个版本的功能相同。

在springboot中使用log4j2时,需要排除springboot默认的logback

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-log4j2</artifactId>
</dependency>

 

四、LOG4J基础配置

<?xml version="1.0" encoding="UTF-8"?>
 <Configuration>
   <Appenders>
     <Console name="Console" target="SYSTEM_OUT">
       <PatternLayout pattern="%d{HH:mm:ss.SSS} [%t] %level %logger{1.} - %msg%n"/>
     </Console>
   </Appenders>
   <Loggers>
     <Root level="error">
       <AppenderRef ref="Console"/>
     </Root>
   </Loggers>
 </Configuration>

五、LOG4J较全配置

<?xml version="1.0" encoding="UTF-8"?>
<!--
日志级别以及优先级排序:
OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL
-->
<configuration status="WARN" monitorInterval="30">
    <Properties>
        <!--        <Property name="LOG_ROOT">${sys:user.home}/logs</Property>-->
        <Property name="LOG_ROOT">./logs</Property>
        <Property name="LOG_PATTERN">%d{yyyy-MM-dd HH:mm:ss,SSS} %level [%thread] %logger{1.} - %msg%n</Property>
    </Properties>
    <!--定义appender-->
    <appenders>
        <console name="Console" target="SYSTEM_OUT">
            <!--输出日志的格式-->
            <PatternLayout pattern="${LOG_PATTERN}"/>
        </console>
        <RollingFile name="info" fileName="${LOG_ROOT}/info.log"
                     filePattern="${LOG_ROOT}/$${date:yyyyMM}/info-%d{yyyyMMdd}-%i.log">
            <!--控制台只输出level及以上级别的信息(onMatch),其他的直接拒绝(onMismatch)-->
            <ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
            <PatternLayout pattern="${LOG_PATTERN}"/>
            <Policies>
                <SizeBasedTriggeringPolicy size="1024 MB"/>
            </Policies>
        </RollingFile>
        <RollingFile name="warn" fileName="${LOG_ROOT}/warn.log"
                     filePattern="${LOG_ROOT}/$${date:yyyyMM}/warn-%d{yyyyMMdd}-%i.log">
            <ThresholdFilter level="warn" onMatch="ACCEPT" onMismatch="DENY"/>
            <PatternLayout pattern="${LOG_PATTERN}"/>
            <Policies>
                <SizeBasedTriggeringPolicy size="1024 MB"/>
            </Policies>
            <DefaultRolloverStrategy max="20"/>
        </RollingFile>
        <RollingFile name="error" fileName="${LOG_ROOT}/error.log"
                     filePattern="${LOG_ROOT}/$${date:yyyyMM}/error-%d{yyyyMMdd}-%i.log">
            <ThresholdFilter level="error" onMatch="ACCEPT" onMismatch="DENY"/>
            <PatternLayout pattern="${LOG_PATTERN}"/>
            <Policies>
                <SizeBasedTriggeringPolicy size="1024 MB"/>
            </Policies>
        </RollingFile>
    </appenders>
    <loggers>
        <!-- OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
        <!--过滤 spring mybatis 的 DEBUG 信息-->
        <logger name="org.springframework" level="INFO"></logger>
        <logger name="org.mybatis" level="INFO"></logger>
        <root level="INFO">
            <appender-ref ref="Console"/>
            <appender-ref ref="info"/>
            <appender-ref ref="warn"/>
            <appender-ref ref="error"/>
        </root>
    </loggers>
</configuration>

 

六、LOGBACK配置

logback.xml or logback-spring.xml

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <!-- 日志存放路径 -->
    <property name="log.path" value="./logs"/>
    <!-- 日志天数 -->
    <property name="log.history" value="60"/>
    <!-- 日志轮转大小 -->
    <property name="log.size" value="1024MB"/>
    <!-- 日志输出格式 -->
    <!--    <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} -%5p ${PID:-} [%15.15t] %-40.40logger{39} : %m%n" />-->
    <property name="log.pattern" value="%d{yyyy-MM-dd HH:mm:ss.SSS} -%5p [%15.15t] %-40.40logger{30} : %m%n"/>

    <!-- 控制台输出 -->
    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
    </appender>

    <!-- 系统日志输出 -->
    <!-- ch.qos.logback.classic.AsyncAppender -->
    <appender name="info" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.path}/info.log</file>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${log.path}/info-%d{yyyyMMdd}.%i.log</fileNamePattern>
            <maxHistory>${log.history}</maxHistory>
            <maxFileSize>${log.size}</maxFileSize>
        </rollingPolicy>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>INFO</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>

    <!-- 用户访问日志输出  -->
    <appender name="warn" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.path}/warn.log</file>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${log.path}/warn-%d{yyyyMMdd}.%i.log</fileNamePattern>
            <maxHistory>${log.history}</maxHistory>
            <maxFileSize>${log.size}</maxFileSize>
        </rollingPolicy>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>WARN</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>

    <appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <file>${log.path}/error.log</file>
        <encoder>
            <pattern>${log.pattern}</pattern>
        </encoder>
        <rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
            <fileNamePattern>${log.path}/error-%d{yyyyMMdd}.%i.log</fileNamePattern>
            <maxHistory>${log.history}</maxHistory>
            <maxFileSize>${log.size}</maxFileSize>
        </rollingPolicy>
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>ERROR</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
    </appender>

    <!-- 日志级别  -->
    <logger name="org.springframework" level="warn"/>
    <logger name="org.mybatis" level="INFO"/>

    <!-- OFF > FATAL > ERROR > WARN > INFO > DEBUG > TRACE > ALL -->
    <springProfile name="default">
        <root level="INFO">
            <appender-ref ref="console"/>
            <appender-ref ref="info"/>
            <appender-ref ref="warn"/>
            <appender-ref ref="error"/>
        </root>
    </springProfile>

    <springProfile name="beta,test">
        <root level="INFO">
            <appender-ref ref="console"/>
            <appender-ref ref="info"/>
            <appender-ref ref="warn"/>
            <appender-ref ref="error"/>
        </root>
    </springProfile>

    <springProfile name="prod">
        <root level="WARN">
            <appender-ref ref="console"/>
            <appender-ref ref="info"/>
            <appender-ref ref="warn"/>
            <appender-ref ref="error"/>
        </root>
    </springProfile>

</configuration>

 

备注:内容摘自网络,有问题联系我们删除或修改。

.

发表在 java | log4j.xml / logback.xml已关闭评论

Python 国内镜像

国内镜像清单

  • 清华:https://pypi.tuna.tsinghua.edu.cn/simple
  • 阿里云:http://mirrors.aliyun.com/pypi/simple/
  • 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/
  • 华中理工大学:http://pypi.hustunique.com/
  • 山东理工大学:http://pypi.sdutlinux.org/
  • 豆瓣:http://pypi.douban.com/simple/

临时修改

pip3 install 库名 -i 镜像地址

例:从清华这边的镜像去安装pyspider库。
pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pyspider

永久修改

touch ~/.pip/pip.conf
vi ~/.pip/pip.conf
[global]
index-url=https://pypi.tuna.tsinghua.edu.cn/simple
[install]
trusted-host=pypi.tuna.tsinghua.edu.cn

mkdir ~/.pip/
echo '' > ~/.pip/pip.conf
echo '[global]' >> ~/.pip/pip.conf
echo 'index-url = https://pypi.tuna.tsinghua.edu.cn/simple' >> ~/.pip/pip.conf
echo '[install]' >> ~/.pip/pip.conf
echo 'trusted-host=pypi.tuna.tsinghua.edu.cn' >> ~/.pip/pip.conf
echo '' >> ~/.pip/pip.conf

 


清华参考:https://mirror.tuna.tsinghua.edu.cn/help/pypi/

临时使用

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple some-package

注意,simple 不能少, 是 https 而不是 http

设为默认

升级 pip 到最新的版本 (>=10.0.0) 后进行配置:

pip install pip -U
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple

如果您到 pip 默认源的网络连接较差,临时使用本镜像站来升级 pip:

pip install -i https://pypi.tuna.tsinghua.edu.cn/simple pip -U

 

 

。。。

发表在 python | Python 国内镜像已关闭评论

密码保护:三维空间距离/失量/向量/夹角算法

此内容受密码保护。如需查阅,请在下列字段中输入您的密码。

发表在 info, space | 密码保护:三维空间距离/失量/向量/夹角算法已关闭评论

密码保护:角度与弧度转换

此内容受密码保护。如需查阅,请在下列字段中输入您的密码。

发表在 info, space | 密码保护:角度与弧度转换已关闭评论

Python3环境搭建

linux环境

查看是否已安装python版本:

python -V

一般系统会自带安装python2的,yum等其他软件会用到

查看系统自带安装的python2的位置

whereis python

找到python2的可执行脚本位置,安装好python3,需要创建软连接到对应位置

查看并安装python3依赖,如果已经安装的话就不用再安装了

rpm -qa zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel

下载python3安装包

wget -P /usr/local https://www.python.org/ftp/python/3.6.5/Python-3.6.5.tar.xz

安装配置python3

切换到安装包目录:cd /usr/local/
解压:tar -xJvf Python-3.6.5.tar.xz 或者 xz Python-3.6.5.tar.xz tar -xvf Python-3.6.5.tar
切换到解压目录:cd Python-3.6.5
编译安装python:

./configure prefix=/usr/local/python3

make && make install

创建软连接:

ln ./python3/bin/python3 /usr/bin/python3

ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

测试:python3 -V 显示Python 3.6.5 安装完成
————————————————

windows10

  1. 至 https://registry.npmmirror.com/binary.html?path=python/ 下载
    python-x.x.x-embed-amd64.zip
  2. 添加 环境变量 python 与 python/Scripts
  3. 执行python -V 显示 Python 3.7.1  OK绿色版python3安装成功
  4. 安装pip
    1. 打开cmd切换到python3安装目录
    2. 编辑python37._pth文件添加 Lib\site-packages 如下图所示:
    3. 注:官网是通过get-pip.py这个文件安装的,如果不想配置python37._pth这个文件。也可以把对应目录下的模块拷贝到python37._pth这个文件配置的目录下,否则执行pip的时候会报找不到模块的错误。
    4. 下载get-pip.py
      https://bootstrap.pypa.io/get-pip.py
      在cmd下运行python get-pip.py
      运行 pip 出现以下错误,则是因没有执行 B 编辑 python37._pth添加 Lib\site-packages 操作导致:

      Traceback (most recent call last):
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\runpy.py", line 193, in _run_module_as_main
      File "D:\obj\windows-release\37amd64_Release\msi_python\zip_amd64\runpy.py", line 85, in run_code
      File "C:\python37\Scripts\pip.exe_main
      .py", line 5, in <module>
      ModuleNotFoundError: No module named 'pip'

 

==============================================

本文将python版本升级到python3.9.0版本

第一步:安装相关依赖包和编译环境

yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gdbm-devel db4-devel libpcap-devel xz-devel gcc

(注意:这一步很重要,如果不安装相关依赖包,在使用pip安装python包时会报找不到SSL错误!)

第二步:下载python3.9.0安装包

wget https://www.python.org/ftp/python/3.9.0/Python-3.9.0.tar.xz

第三步:解压安装包并创建安装目录

xz -d Python-3.9.0.tar.xz

tar -xvf Python-3.9.0.tar

mkdir /usr/local/python3.9.0

第四步:编译安装

cd Python-3.9.0

./configure --with-ssl --prefix=/usr/local/python3.9.0

(注意:prefix后面配置第三步中创建的路径,且等号两边不能有空格,不然会报错)

make && make install

第五步:创建python3.6.5软链接

ln -s /usr/local/python3.9.0/bin/python3.9 /usr/bin/python3

ln -s /usr/local/python3.9.0/bin/pip3.9 /usr/bin/pip3

升级pip3
python3 -m pip install --upgrade pip

 

...

 

 

 

 

发表在 python | Python3环境搭建已关闭评论

密码保护:空间目标轨道计算

此内容受密码保护。如需查阅,请在下列字段中输入您的密码。

发表在 space | 密码保护:空间目标轨道计算已关闭评论