环境部署
python原创工具小于 1 分钟约 245 字
安装依赖包
#yum install readline-devel gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel ##必须安装否则会出现python3编译器中不能使用退格键和方向键
下载安装包
wget https://www.python.org/ftp/python/3.6.1/Python-3.6.1.tgz
解压安装包
tar zvxf Python-3.6.1.tgz
创建安装目录
mkdir /usr/local/python3
安装命令
./configure --prefix=/usr/local/python36 --enable-shared --with-ssl
make
make install
添加软链接
ln -s /usr/local/python3/bin/pip3.8 /usr/bin/pip
ln -s /usr/local/python3/bin/python3.8 /usr/bin/python
创建虚拟环境
python -m venv venv
虚拟环境使用
source activate
错误处理
- python3: error while loading shared libraries: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory
# 查看动态链接库
ldd /usr/local/python36/bin/python3
# 复制文件
cp libpython3.6m.so.1.0 /usr/lib64/
- pip is configured with locations that require TLS/SSL, however the ssl module in Python is not available ·pip install pyinstaller -i http://pypi.douban.com/simple --trusted-host pypi.douban.com`
- pip限制https
# 创建文件
vi ~/.pip/pip.conf
# 复制以下内容
[global]
index-url = http://mirrors.aliyun.com/pypi/simple/
[install]
trusted-host = mirrors.aliyun.com