1. Verwenden Sie nach dem Erstellen einer virtuellen Maschine in VMware yum, um das Installationspaket herunterzuladen, und stellen Sie fest, dass es nicht heruntergeladen werden kann:
【已解决】:
备份配置文件,防止以后出错后不好恢复:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bak
执行下面命令,新建CentOS-Base.repo配置:
vim /etc/yum.repos.d/CentOS-Base.repo
复制粘贴如下命令
[centos-office]
name=centos-office
failovermethod=priority
baseurl=https://vault.centos.org/6.10/os/x86_64/
gpgcheck=1
gpgkey=https://vault.centos.org/6.10/os/x86_64/RPM-GPG-KEY-CentOS-6
保存后退出,执行yum list 正常无报错
Zweitens Probleme mit der Python3.7-Umgebung:
准备工作:
问题一:libc.so.6: version `GLIBC_2.14' not found
参考连接:https://blog.csdn.net/cpplang/article/details/8462768
1. 下载
wget http://mirrors.ustc.edu.cn/gnu/libc/glibc-2.14.tar.gz
2. 解压
tar -zxvf glibc-2.14.tar.gz
3. 创建一个目录进到目录
mkdir build
cd build
4. 运行配置然后编译
../configure --prefix=/opt/glibc-2.14
make -j4 && make install && make localedata/install-locales
问题二:WARNING: pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available
参考连接:https://www.cnblogs.com/larack/p/12196850.html
1. 下载openssl
wget https://www.openssl.org/source/openssl-1.1.1a.tar.gz
tar -zxvf openssl-1.1.1a.tar.gz
cd openssl-1.1.1a
2. 编译安装
./config --prefix=/usr/local/openssl no-zlib #不需要zlib
make
make install
3. 备份原配置
mv /usr/bin/openssl /usr/bin/openssl.bak
mv /usr/include/openssl/ /usr/include/openssl.bak
4. 新版配置
ln -s /usr/local/openssl/include/openssl /usr/include/openssl
ln -s /usr/local/openssl/lib/libssl.so.1.1 /usr/local/lib64/libssl.so
ln -s /usr/local/openssl/bin/openssl /usr/bin/openssl
5. 修改系统配置,写入openssl库文件的搜索路径
echo "/usr/local/openssl/lib" >> /etc/ld.so.conf
6. 使修改后的/etc/ld.so.conf生效
ldconfig -v
7. 查看openssl版本
openssl version
问题三:python: error while loading shared libraries: libpython3.7m.so.1.0: cannot open shared object file:
参考连接:https://blog.csdn.net/weixin_43840640/article/details/89478729
1. cd /usr/local/bin/python3/lib
2. cp libpython3.7m.so.1.0 /usr/lib64
3. python -V
开始安装:
1. 安装相关依赖
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel gcc make
2. 安装一个最匹配的(不然下面运行python3.7或者搭建虚拟环境有一堆问题)
yum install libffi-devel -y (libffi-devel-3.0.5-3.2.el6.x86_64)
3. 下载python3.7安装包
wget https://www.python.org/ftp/python/3.7.0/Python-3.7.0.tar.xz
4. 解压并编译
tar -xvJf Python-3.7.0.tar.xz
cd Python-3.7.0
./configure prefix=/usr/local/python3 --with-openssl=/usr/local/openssl --enable-shared --enable-optimizations
make && make install
5. 备份并创建软连接
mv /usr/bin/python /usr/bin/python.bak
ln -s /root/Python-3.7.0/python /usr/bin/python
6. 清除之前编译的文件
make clean
make distclean
3. Einfache Verwendung der virtuellen Python-Umgebung:
参考连接: https://zhuanlan.zhihu.com/p/146505965
安装准备:
1. 安装虚拟环境和管理工具:
pip install virtualenv
pip install virtualenvwrapper
2. 创建一个文件夹用来放虚拟环境
mkdir .virtualenvs
3. 获取之前安装的python执行文件和virtualenvwrapper.sh执行文件的存放路径
find / -name virtualenvwrapper.sh
4. 添加以下内容到家目录.bashrc
export WORKON_HOME=~/.virtualenvs
export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python
source /usr/local/python3/bin/virtualenvwrapper.sh
5. 刷新.bashrc
source .bashrc
使用虚拟环境:
1. 新建一个虚拟环境
mkvirtualenv test
2. 退出当前虚拟环境
deactivate
3. 查看所有的虚拟环境
workon
lsvirtualenv
4. 进入某个虚拟环境
workon test
5. 删除虚拟环境
rmvirtualenv test