jzztf / wiki

wiki
https://jzztf.github.io
Other
1 stars 0 forks source link

py-virtualenv #31

Open jzztf opened 6 years ago

jzztf commented 6 years ago

python 版本管理工具 virtualenv

安装

使用

$ virtualenv myproject.env
$ source ./myproject.env/bin/activate
(myproject.env) $ deactivate

常用参数

windows下使用

jzztf commented 6 years ago

pipenv---将pip与virtualenv结合

安装

$ pip3 install pipenv

简单使用

$ cd project
project $ pipenv install [package-name] [packages,]
$ pipenv graph
# 查看当前环境
$ pipenv shell  
# 生成虚拟shell, 类似于virtualenv中使用"source ./~/activate"
# exit退出
$ pipenv run python xx.py
# 使用虚拟环境运行Python程序
$ pipenv --rm
# 删除虚拟环境
$ pipenv -- help
# 更多用法
jzztf commented 6 years ago

Keeping your virtualenv inside your project directory

将virtualenv管理的包放置在项目目录

links:

jzztf commented 6 years ago

autoenv

自启动虚拟黄静

links:

jzztf commented 6 years ago

set a virtual environment for jupyter notebook

设置一个jupyter notebook的虚拟环境(定制内核)

$ cd project
$ pipenv install
$ pipenv shell
$ pip install ipykernel
$ python -m ipykernel install --user --name="your kernel name"
# the new kernel will be in your jupyter notebook

links:

jzztf commented 6 years ago

manage pip install sources

修改pip安装源

配置方法

在文件

~/.pip/pip.conf

中添加或修改:

[global]
index-url = https://mirrors.aliyun.com/pypi/simple/

[install]
trusted-host=mirrors.aliyun.com

links: