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@localhost ~]$ git clone https://github.com/pyenv/pyenv.git

[python@localhost ~]$git clone https://github.com/yyuu/pyenv-virtualenv.git ~/.pyenv/plugins/pyenv-virtualenv

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

[python@kang ~]$ source .bashrc

pyenv  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

mkdir  projects/assetsmg

cd projects/assetsmg

pyenv virtualenv 3.7.8(版本) kang378(别名)

[python@kang assetsmg]$ pyenv virtualenv 3.7.8 kang378
[python@kang assetsmg]$ pyenv local kang378

升级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

 

posted @ 2019-09-20 14:20  冬日的温暖  阅读(305)  评论(0编辑  收藏  举报