python使用环境的设置

时间:2022-06-09 05:35:15

virtualenv usage

mkidr ~/pyenv
cd ~/pyenv
virtualenv pycaffe #it will setup a new python environtment named pycafffe
. pycaffe/bin/activate #it will activate your pycaffe dependent virtual environment( pycaffe in your shell )
deactiver #leave your current python environment

//then every package installed by python will be stored independently.

Reference:

http://*.com/questions/18966564/pip-freeze-vs-pip-list

https://virtualenvwrapper.readthedocs.io/en/latest/

pip更新软件包的源

mkdir ~/.pip
cd .pip
vim pip.conf

and add flowing source address

[global]
index-url = https://mirrors.ustc.edu.cn/pypi/web/simple/

当然也可以尝试aliyun的源

:有时需要更新pip

pip -verbose install  -U pip

系统python不是python2.7

如果系统是python 2.7,那么我们每个virtual python也是python 2.7

但如果系统本身不是我所需要用的python2.7,那么我们需要在本地也安装python 2.7,并且本地安装virtualenv使用我们本地安装的python 2.7

具体安装方法

cs4版本python安装

How to change python from UCS2 to UCS4

解决undefined reference to "PyUnicodeUCS4_*

mac版pyenv安装

安装pyenv

brew install pyenv

查看有哪些版本python可以安装

pyenv install --list

安装

pyenv install 2.7.12

查看当前安装了哪些版

pyenv versions

切换python版本

pyenv global 2.7.12