python3.8.8源码安装,import ssl报错

2、删除原有目录

删除安装目录;----删除包之后还不行,因为此时执行python3还是可以的,证明没有删除成功,需要把bin目录下的删除掉;

删除命令

rm -rf /usr/bin/pip3
rm -rf /usr/bin/python3
rm -rf /usr/bin/python3.8
验证

源码安装命令
178 cd Python-3.8.8.tgz
179 tar -xvf Python-3.8.8.tgz
180 cd Python-3.8.8
181 ls
182 vim ./Modules/Setup
取消注释:
vim Python-3.8.8/Modules/Setup ;取消以下注释

# Socket module helper for socket(2)
_socket socketmodule.c timemodule.c

# Socket module helper for SSL support; you must comment out the other
# socket line above, and possibly edit the SSL variable:

183 ls
184 history
185 ./configure --prefix=/usr/local/python3.8 --with-ssl
186 make && make install

** 检查指向 **
199 ls /usr/bin/python* -l
200 ls /usr/local/bin/pip3 -l
运行 /usr/bin/python3 ,再输入import ssl验证;
[root@4dc142851594 Python-3.8.8]# ls /usr/bin/python* -l
lrwxrwxrwx 1 root root 7 May 8 02:09 /usr/bin/python -> python2
lrwxrwxrwx 1 root root 9 May 8 02:09 /usr/bin/python2 -> python2.7
-rwxr-xr-x 1 root root 7144 Nov 16 2020 /usr/bin/python2.7
lrwxrwxrwx 1 root root 34 May 8 06:19 /usr/bin/python3 -> /usr/local/python3.8/bin/python3.8

解决问题:
[root@4dc142851594 Python-3.8.8]# python3
bash: /usr/local/bin/python3: No such file or directory
[root@4dc142851594 Python-3.8.8]# pip3
bash: /usr/local/bin/pip3: /usr/local/bin/python3.8: bad interpreter: No such file or directory

理解安装命令
185 ./configure --prefix=/usr/local/python3.8 --with-ssl
186 make && make install
187 python3
188 history
先删除
[root@4dc142851594 Python-3.8.8]# rm -rf /usr/bin/pip3
[root@4dc142851594 Python-3.8.8]# rm -rf /usr/bin/python3
再指定
189 ln -s /usr/local/python3.8/bin/pip3.8 /usr/bin/pip3
190 pip3
191 ln -s /usr/local/python3.8/bin/python3.8 /usr/bin/python3
再执行
[root@4dc142851594 /]# /usr/bin/python3
Python 3.8.8 (default, May 8 2022, 06:40:35)
[GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
Type “help”, “copyright”, “credits” or “license” for more information.

import ssl
1、*

  • [root@4dc142851594 /]# python3
    Python 3.8.8 (default, May 8 2022, 06:40:35)
    [GCC 4.8.5 20150623 (Red Hat 4.8.5-44)] on linux
    Type “help”, “copyright”, “credits” or “license” for more information.

exit()
con
figure,这一步一般用来生成 Makefile,为下一步的编译做准备,你可以通过在 configure 后加上参数来对安装进行控制,比如代码:./configure –prefix=/usr 意思是将该软件安装在 /usr 下面,执行文件就会安装在 /usr/bin (而不是默认的 /usr/local/bin)**,资源文件就会安装在 /usr/share(而不是默认的/usr/local/share)。同时一些软件的配置文件你可以通过指定 –sys-config= 参数进行设定。有一些软件还可以加上 –with、–enable、–without、–disable 等等参数对编译加以控制,你可以通过允许 ./configure –help 察看详细的说明帮助。

2、make,这一步就是编译,大多数的源代码包都经过这一步进行编译(当然有些perl或python编写的软件需要调用perl或python来进行编译)。如果 在 make 过程中出现 error ,你就要记下错误代码(注意不仅仅是最后一行),然后你可以向开发者提交 bugreport(一般在 INSTALL 里有提交地址),或者你的系统少了一些依赖库等,这些需要自己仔细研究错误代码。

3、make insatll,这条命令来进行安装(当然有些软件需要先运行 make check 或 make test 来进行一些测试),这一步一般需要你有 root 权限(因为要向系统写入文件)。



/usr/bin/pip3 install jupyterlab -i http://pypi.douban.com/simple/ --trusted-host pypi.douban.com\

** 运行报错 ,先卸载删除rm -rf /usr/local/bin/jupyte*,再重装**

Error: Nothing to do
[root@4dc142851594 bin]# jupyter lab
bash: /usr/local/bin/jupyter: /usr/local/bin/python3.8: bad interpreter: No such file or directory
[root@4dc142851594 bin]# ls /usr/local/bin/
2to3              jupyter-bundlerextension  jupyter-nbconvert        pip3.8
2to3-3.8          jupyter-dejavu            jupyter-nbextension      pybabel
easy_install-3.8  jupyter-execute           jupyter-notebook         pydoc3
idle3             jupyter-kernel            jupyter-run              pydoc3.8
idle3.8           jupyter-kernelspec        jupyter-server           pygmentize
ipython           jupyter-lab               jupyter-serverextension  pyjson5
ipython3          jupyter-labextension      jupyter-troubleshoot     send2trash
jlpm              jupyter-labhub            jupyter-trust            wsdump
jsonschema        jupyter-migrate           normalizer
jupyter           jupyter-nbclassic         pip3
[root@4dc142851594 bin]# rm -rf /usr/local/bin/jupyte*
[root@4dc142851594 bin]# ls /usr/local/bin/
2to3              idle3    ipython3    normalizer  pybabel   pygmentize  wsdump
2to3-3.8          idle3.8  jlpm        pip3        pydoc3    pyjson5
easy_install-3.8  ipython  jsonschema  pip3.8      pydoc3.8  send2trash
[root@4dc142851594 bin]# jupyter lab
bash: /usr/local/bin/jupyter: No such file or directory

[root@4dc142851594 bin]# find / -name ‘jupyter’
/usr/local/etc/jupyter
/usr/local/share/jupyter
/usr/local/python3.8/etc/jupyter
/usr/local/python3.8/share/jupyter
/usr/local/python3.8/bin/jupyter

启动jupyter lab;直接找到二进制安装包
[root@4dc142851594 bin]# /usr/local/python3.8/bin/jupyter lab

** 启动容器让外部可以访问**

3、参考网址

https://blog.birost.com/a?ID=00800-be366b2d-bbe0-45d5-9b9e-2f22f272084a

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值