pyenv环境部署

pyenv环境部署
pyenv安装使用git
[root@kang ~]# yum install git -y

python安装依赖
yum -y install gcc make patch gdbm-devel openssl-devel sqlite-devel readline-devel zlib-devel bzip2-devel

创建用户python
useradd python

使用python用户登录
curl -L https://raw.githubusercontent.com/pyenv/pyenv-installer/master/bin/pyenv-installer | bash

在pythonet用户的.~/.bashrc中追加:
export PATH="/home/python/.pyenv/bin:$PATH"
eval "$(pyenv init -)"
eval "$(pyenv virtualenv-init -)"

[python@kang ~]$ source .bashrc

pyenv -v install 3.5.3 #按装指定版本

pip通用配置:
mkdir ~/.pip
vim ~/.pip/pip.conf
[global]
index-url=https://mirrors.aliyun.com/pypi/simple/trusted-host=mirrors.aliyun.com

使用虚拟环境插件Virtualenv
pyenv virtualenv 3.5.3(版本) LHtest(别名)

[python@kang lhpython3]$ pyenv virtualenv 3.5.3 lhtest353
[python@kang lhpython3]$ pyenv local lhtest353

升级pip遇到的坑
(lhtest353) [python@kang lhpython3]$ pip install --upgrade pip
Requirement already up-to-date: pip in /home/python/.pyenv/versions/3.5.3/envs/lhtest353/lib/python3.5/site-packages
You are using pip version 9.0.1, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

可以查看详细报错
(lhtest353) [python@kang lhpython3]$ pip install --upgrade pip -vvv
1 location(s) to search for versions of pip:
* https://mirrors.aliyun.com/pypi/simple/trusted-host=mirrors.aliyun.com/pip/
Getting page https://mirrors.aliyun.com/pypi/simple/trusted-host=mirrors.aliyun.com/pip/
Looking up "https://mirrors.aliyun.com/pypi/simple/trusted-host=mirrors.aliyun.com/pip/" in the cache
No cache entry available
Starting new HTTPS connection (1): mirrors.aliyun.com
"GET /pypi/simple/trusted-host=mirrors.aliyun.com/pip/ HTTP/1.1" 404 2517
Status code 404 not in [200, 203, 300, 301]
Could not fetch URL https://mirrors.aliyun.com/pypi/simple/trusted-host=mirrors.aliyun.com/pip/: 404 Client Error: Not Found for url: https://mirrors.aliyun.com/pypi/simple/trusted-host=mirrors.aliyun.com/pip/ - skipping
Installed version (9.0.1) is most up-to-date (past versions: none)
Requirement already up-to-date: pip in /home/python/.pyenv/versions/3.5.3/envs/lhtest353/lib/python3.5/site-packages
Cleaning up...
You are using pip version 9.0.1, however version 19.2.3 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

--------------
删除先前配置的加速站点:
pip通用配置:
mkdir ~/.pip
vim ~/.pip/pip.conf
[global]
index-url=https://mirrors.aliyun.com/pypi/simple/trusted-host=mirrors.aliyun.com
---------------------


(lhtest353) [python@kang lhpython3]$ pip install Django==1.11.18

 

pycharm 配置远程主机信息(centos)

~/home/.pyenv/versions/3.5.2/bin/python3.5

 

转载于:https://www.cnblogs.com/centos-kang/p/11556892.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值