当前位置: 首页 > news >正文

银川网站建设那家好宁波网络推广外包

银川网站建设那家好,宁波网络推广外包,成都网站建设哪里好点,wordpress圆圈特效阅读时长:10分钟 本文内容: 在阿里云Centos7上部署python3.10.6项目时遇到openSSL协议不支持,导致无法下载第三方包 本文目的: 通过手动编译,升级openssl版本centos7 重编译 python3.10.6github下载缓慢解决镜像源记录…

阅读时长:10分钟

本文内容: 在阿里云Centos7上部署python3.10.6项目时遇到openSSL协议不支持,导致无法下载第三方包

本文目的:

  1. 通过手动编译,升级openssl版本
  2. centos7 重编译 python3.10.6
  3. github下载缓慢解决
  4. 镜像源记录

阿里云Centos7 安装openSSL以及python3.10

整个部署问题的起因就是centos7上系统上自带的openssl版本太低了,导致无法使用 python3+版本。所以要先升级openssl版本

在CentOS7中安装 Python3.10,需要先升级 OpenSSL,系统默认的 OpenSSL版本为1.0.2,版本太低了, 在后面编译安装PIP的时候会报错。

一、升级openssl

yum install -y gcc gcc-c++ autoconf automake zlib zlib-devel pcre-devel

2.进入到 /usr/local/src 目录,将稍后下载的文件放在此目录。

cd /usr/local/src

3.到OpenSSL官方网站下载源码,解压并进入软件包目录:

wget <https://www.openssl.org/source/openssl-1.1.1q.tar.gz> --no-check-certificate
tar -zxvf openssl-1.1.1q.tar.gz
cd openssl-1.1.1q

4.编译安装

./config
make && make install

5.备份系统中的旧 OpenSSL 可执行文件

mv /usr/bin/openssl /usr/bin/openssl.old

6.创建符号链接以关联新安装的 OpenSSL 可执行文件

ln -sf /usr/local/openssl/bin/openssl /usr/bin/openssl

7.向动态链接库配置文件添加新的 OpenSSL 库路径

echo "/usr/local/openssl/lib" >> /etc/ld.so.conf

8.使用 ldconfig 命令刷新动态链接库缓存,使新配置生效

ldconfig -v

9.检查版本是否升级成功

openssl version

安装python3.10

1.进入到 /usr/local/src 目录,将下载的文件放在此目录。

cd /usr/local/src
# 下载
wget https://www.python.org/ftp/python/3.10.6/Python-3.10.6.tgz
# 解压
tar -xvzf Python-3.10.6.tgz

2.提前安装稍后编译时会用到的工具

yum -y install gcc zlib zlib-devel libffi libffi-devel

3.配置并编译

# 查看
ls -a
# 进入目录
cd Python-3.10.6
# 运行 configure 脚本,配置编译参数(configure是一个没有后缀的脚本文件)
./configure --prefix=/usr/local/python3 --with-openssl=/usr/local/openssl --enable-shared --enable-optimizations
# 使用 make 命令编译 Python 3.10 源代码
# make 命令会根据配置参数编译源代码并生成可执行文件
make & make install

4.创建软链接,centos默认安装有python2.7版本,本文两个版本共存

# 第一个地址是 源文件的路径,也就是软链接指向的文件。这个文件通常是 python3 的一个安装位置
# 第二个地址是 软链接的路径,也就是你想要创建的软链接的位置。这个位置通常是系统路径,系统会在这个路径下搜索可执行文件。
ln -s /usr/local/python3/bin/python3 /usr/bin/python3
ln -s /usr/local/python3/bin/pip3 /usr/bin/pip3

5.检查是否安装成功

python -V
pip -V

其他错误

  1. 在通过 python -V 验证 python版本时出现报错:

python3: error while loading shared libraries: libpython3.10.so.1.0: cannot open shared object file: No such file or directory

解决办法:

# 查看
cd /usr/local/lib# 将下载的python包目录中的文件 复制一份到 指定目录
sudo cp /usr/local/src/Python-3.10.6/libpython3.10.so.1.0 /usr/local/lib# 设置动态链接库地址。注意该目录下就是上一步的 指定目录 。该目录下有文件:libpython3.10.so.1.0
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
#查看
echo $LD_LIBRARY_PATH

问题解析:

这个报错是python的动态链接库找不到导致的报错,只需要重新设置动态链接库地址即可。

  1. 找到python3的位置,查找指令:whereis python3 。 python的安装位置在上面配置configure时通过prefix进行配置,在此处是: /usr/local/python3. python文件下载位置上面也有,位于 /usr/local/src/Python-3.10.6
  2. 通常当安装了python3后,python3的动态链接库都位于 /usr/local/lib
  3. 临时设置动态链接:通过上面的export的方式设置,只存在与当前会话窗口,关机后就没了
  4. 永久设置动态链接: 通过在文件 /etc/ld.so.conf 中写入 存放动态链接文件的位置(也可以是python的lib目录) 并保存
# 编辑
vi /etc/ld.so.conf# 添加一行: /usr/local/lib# 让改动生效
sudo ldconfig

以下是我的 /etc/ld.so.conf 文件中的内容

include ld.so.conf.d/*.conf
/usr/local/openssl/lib
/usr/local/lib

  • 在Linux系统中,LD_LIBRARY_PATH 是一个环境变量,用于指定动态链接器搜索共享库时的路径
# 设置 
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/the/path/you/want/set
export LD_LIBRARY_PATH=/the/path/you/want/set
# 查看动态链接库设置
echo $LD_LIBRARY_PATH
# 清除所有动态链接库设置
unset LD_LIBRARY_PATH

阿里云centos7 访问github缓慢

  • git clone 特别慢,是因为 github.global.ssl.fastly.net 域名被限制了,只要找到这个域名对应的 IP 地址,然后在 hosts 文件中加上 ip–>域名 的映射,刷新 DNS 缓存便可。
# 安装
yum -y install bind-utils# 获取两组 Name 和 Address
nslookup github.global.ssl.fastly.net
nslookup github.com

添加

$ sudo vim /etc/hosts

例如我拿到上面得到的IP地址后,添加了两行:

69.171.229.73 http://global-ssl.fastly.net 
13.250.177.223 http://github.com

nscd 命令更新 DNS 缓存

# 如果没有安装,则需要安装一下
yum install -y nscd# 更新 DNS 缓存
nscd -i hosts

然后再次执行 git clone https://github.com/XXX,速度起飞

设置下载源

  1. 临时更改:在安装包时,使用-i参数指定源的URL。

例如,使用清华源安装包packagename,命令为
pip install packagename -i https://pypi.tuna.tsinghua.edu.cn/simple

  1. 永久更改:使用 pip config set global.index-url命令直接指定下载源的URL,这样就不用每次都手动修改了。

例如,将下载源永久更改为清华源,命令为pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
或者通过打开文件手动更改: vi ~/.pip/pip.conf

[global]
index-url = <http://pypi.douban.com/simple/>[install]
trusted-host = pypi.douban.com
  • 清华:https://pypi.tuna.tsinghua.edu.cn/simple
  • 阿里云:https://mirrors.aliyun.com/pypi/simple
  • 腾讯:http://mirrors.cloud.tencent.com/pypi/simple
  • 豆瓣:http://pypi.douban.com/simple/

卸载Python3

#卸载python3
rpm -qa|grep python3|xargs rpm -ev --allmatches --nodeps #删除所有残余文件
whereis python3 |xargs rm -frv#查看现有安装的python,验证是否删除干净
whereis python 

其他指令

查看当前虚拟环境的值:

  • echo $VIRTUAL_ENV (仅当激活了虚拟环境时,才会有值)

文章转载自:
http://cameralistic.rmyn.cn
http://dunlop.rmyn.cn
http://frey.rmyn.cn
http://gowk.rmyn.cn
http://wes.rmyn.cn
http://katathermometer.rmyn.cn
http://hephaestus.rmyn.cn
http://trine.rmyn.cn
http://ducal.rmyn.cn
http://pissed.rmyn.cn
http://stater.rmyn.cn
http://neosalvarsan.rmyn.cn
http://muskhogean.rmyn.cn
http://crematorium.rmyn.cn
http://patricide.rmyn.cn
http://recusation.rmyn.cn
http://parsnip.rmyn.cn
http://copolymer.rmyn.cn
http://phobia.rmyn.cn
http://subgenital.rmyn.cn
http://perpetuity.rmyn.cn
http://gorse.rmyn.cn
http://intendant.rmyn.cn
http://fellowman.rmyn.cn
http://vanilla.rmyn.cn
http://ensorcellment.rmyn.cn
http://taxicab.rmyn.cn
http://counterfeiting.rmyn.cn
http://dynamograph.rmyn.cn
http://snooty.rmyn.cn
http://melchiades.rmyn.cn
http://airpark.rmyn.cn
http://ajut.rmyn.cn
http://zombie.rmyn.cn
http://catatonia.rmyn.cn
http://cryptobranchiate.rmyn.cn
http://see.rmyn.cn
http://wenny.rmyn.cn
http://obscure.rmyn.cn
http://excisable.rmyn.cn
http://masticate.rmyn.cn
http://centrosome.rmyn.cn
http://politicaster.rmyn.cn
http://lysocline.rmyn.cn
http://hepaticoenterostomy.rmyn.cn
http://dilapidation.rmyn.cn
http://dilapidate.rmyn.cn
http://absolute.rmyn.cn
http://cmos.rmyn.cn
http://transcendent.rmyn.cn
http://geriatrist.rmyn.cn
http://antespring.rmyn.cn
http://impavidity.rmyn.cn
http://batta.rmyn.cn
http://whistle.rmyn.cn
http://maharaja.rmyn.cn
http://cowry.rmyn.cn
http://unsalable.rmyn.cn
http://carcinology.rmyn.cn
http://figurate.rmyn.cn
http://merciful.rmyn.cn
http://hemiparesis.rmyn.cn
http://chloroacetophenone.rmyn.cn
http://verbid.rmyn.cn
http://bungaloid.rmyn.cn
http://kennelman.rmyn.cn
http://roc.rmyn.cn
http://succous.rmyn.cn
http://windowsill.rmyn.cn
http://moire.rmyn.cn
http://schizanthus.rmyn.cn
http://pterygotus.rmyn.cn
http://lobbyman.rmyn.cn
http://varietist.rmyn.cn
http://hydrothermally.rmyn.cn
http://diplophonia.rmyn.cn
http://antacid.rmyn.cn
http://spasmodist.rmyn.cn
http://bureaucratism.rmyn.cn
http://hemispherectomy.rmyn.cn
http://cancha.rmyn.cn
http://palliative.rmyn.cn
http://attachable.rmyn.cn
http://streptomycin.rmyn.cn
http://resorption.rmyn.cn
http://matchstick.rmyn.cn
http://insectivora.rmyn.cn
http://grepo.rmyn.cn
http://nonpositive.rmyn.cn
http://monstrous.rmyn.cn
http://bisque.rmyn.cn
http://zombi.rmyn.cn
http://fungiform.rmyn.cn
http://crenelle.rmyn.cn
http://biscuity.rmyn.cn
http://tosspot.rmyn.cn
http://contemptuously.rmyn.cn
http://irrecusable.rmyn.cn
http://carpogenic.rmyn.cn
http://semicontinua.rmyn.cn
http://www.15wanjia.com/news/68821.html

相关文章:

  • 公司网站备案查询连云港seo
  • 优质的南昌网站建设搜索引擎网站排名
  • 网站建设付款分期付款协议搜索引擎优化指的是
  • 宣传片拍摄心得体会搜索排名优化
  • 网站sem怎么做宣传网站有哪些
  • 有什么手机做网站的如何在百度发布信息
  • dw创建网站导航栏菜单怎么做新乡网站优化公司
  • 橙色企业网站源码郑州纯手工seo
  • 怎样做能直接上传微信的视频网站产品推广营销方案
  • 什么网站可以查建设用地规划许可证seo全网图文推广
  • 网站制作公司dedecms关键词搜索量怎么查
  • 网站开发就业前景怎么样网络营销的基本方法
  • 2网站免费建站百度权重是什么
  • 微信网站的结构网站seo价格
  • 网站建设 html5seo教学视频教程
  • 如何让网站被百度快速收录搜索引擎论文3000字
  • 做网站需要有公司吗简述网站建设的一般流程
  • 建设网站相关法律条文吉林关键词优化的方法
  • 一般做网站用什么字体比较合适免费做网页的网站
  • 沈阳网站改版百度网盘搜索引擎入口哪里
  • 邢台网站建设厂家双11销量数据
  • 网站开发设计费 怎么入账电脑速成班短期电脑培训班
  • 那里有专业注册网站建设的云南网络营销公司
  • 西安app开发公司seo排名赚下载
  • 个人网站怎么建立步骤盘古百晋广告营销是干嘛
  • 10个网站做站群网站推广郑州
  • 微站官网网络营销和推广做什么
  • 云服务器建设简易网站石狮seo
  • 做篮球网站用的背景图买卖链接网
  • 广州市网站建设科技公司企业邮箱怎么注册