python虚拟环境
官方文档:github/pipenv
虚拟环境的好处
-
隔离环境
-
这个网上说法都有很多了,最实际的,就是不会干扰不同项目。你有的项目使用的可能是python2,那么相关的包也是python2的,有是使用python3,如果不使用虚拟环境,那么首先一点你就没办法安装特定版本的包了。还有一个比较实际的,你有使用要把项目发给别人,要把使用到的包都导出requirements,如果不是使用的虚拟环境,你导入的包可能会远远越过你真正使用的到的包。我之前有做过一个小应用打包成exe方便别人使用,整个项目其实很小,结果由于一开始偷懒没有创建虚拟环境,结果打包后的exe竟然有2,300M大,后面重新放进虚拟环境再打包,真正大小才7M。这个好处不要太明显了。
虚拟环境工具
- virtualenv
- Virtualenvwrapper
- conda
- pipenv
pipenv
pipenv是Python官方推荐的包管理工具。 它综合了 virtualenv , pip 和 pyenv 三者的功能。能够自动为项目创建和管理虚拟环境。如果你使用过requests库,就一定会爱上这个库,因为是同一个大神出品。 pipenv使用 Pipfile 和 Pipfile.lock 来管理依赖包,并且在使用pipenv添加或删除包时,自动维护 Pipfile 文件,同时生成 Pipfile.lock 来锁定安装包的版本和依赖信息,避免构建错误。相比pip需要手动维护requirements.txt 中的安装包和版本,具有很大的进步。
-
安装
sudo su pip install pipenv pip3 install pipenv
-
创建虚拟环境
cd yourproject pipenv install #创建虚拟环境
-
激活pipenv Shell & 部署环境
pipenv shell # 进入虚拟环境 exit # 退出虚拟环境 pipenv install requests #直接安装需要的库 pipenv uninstall requests #卸载不需要的库
-
换源
打开pipfile文件,修改url属性 douban源,清华源,随意选。 url = "https://pypi.douban.com/simple" url = "https://pypi.tuna.tsinghua.edu.cn/simple"
-
其他命令
pipenv --where #显示目录信息 pipenv --venv #显示虚拟环境信息 pipenv --py #显示Python解释器信息 pipenv graph #查看目前安装的库及其依赖 pipenv check #检查安全漏洞
pip换源
经常下东西的时候出现一堆红色报错和
time out
,pip的时候默认的pip源在国外,经常连接超时,所以需要自己设置使用国内的pip源
解决方案如下:
-
临时修改
使用pip3安装的包的时候,加上-i参数,指定使用阿里的pip源安装
pip install pipenv -i http://mirrors.aliyun.com/pypi/simple
-
永久修改
一劳永逸,通过文件永久修改,指定每一次都使用阿里的pip源安装
常用的国内的pip源:
阿里云 http://mirrors.aliyun.com/pypi/simple/ 中国科技大学 https://pypi.mirrors.ustc.edu.cn/simple/ 豆瓣(douban) http://pypi.douban.com/simple/ 清华大学 https://pypi.tuna.tsinghua.edu.cn/simple/ 中国科学技术大学 http://pypi.mirrors.ustc.edu.cn/simple/
linux 系统:
-
创建一个文件夹及文件。文件夹创建时前边要加“.”,表示是隐藏文件夹
-
具体如下:
mkdir ~/.pip cd ~/.pip vi pip.conf # 加入如下内容,使用阿里的pip源 [global] index-url=https://mirrors.aliyun.com/pypi/simple [install] trusted-host=mirrors.aliyun.com
-
参考:
223 comments
how fast does sildenafil work
sildenafil how long to work
sildenafil 50 mg price
can sildenafil be taken daily
sildenafil blood pressure
medical arts pharmacy florida phentermine
buy levitra edu
tadalafil dosage
vardenafil wikipedia
viagra alternative
raso.su
https://hdorg2.ru/
https://hdorg2.ru/
9gm.ru
10000
https://bit.ly/kholostyak-13-kholostyak-2024-kholostyak-dyvytysya-onlayn
dizain-cheloveka
printsipy forda
https://t.me/s/psyholog_online_just_now
https://psyholog_online_just_now.t.me
site
Opsumiologist
human design
humandesignplanet.ru
raschet karty dizayn cheloveka
rasschitat dizayn cheloveka onlayn
kinogo
yaltalife.ru
shorts
https://bit.ly/patsany-4-sezon-vse-seriy-patsany-4-sezon-2024
what is metformin used for
cephalexin for dogs dosage
batmanapollo.ru
trazodone and gabapentin for dogs dosage
modafinil medication
what can you not take with valacyclovir
lyrica and weight gain
side effect of lisinopril
femara versus tamoxifen
can you give a dog amoxicillin
signs that flagyl is working for diverticulitis
does prednisone cause constipation
doxycycline before and after
keflex brand name
what does ampicillin do
order cipro online
augmentin side effects
bit.ly/kto-takoy-opsuimolog
https://bit.ly/patsany-4-sezon-2024
stromectol 3 mg
vardenafil price
buy a kilo of tadalafil powder
cheapest tadalafil india
ivermectin 0.2mg
vardenafil canada pharmacy
ivermectin uk
ivermectin 3 mg
generic name for ivermectin
female viagra medicine price in india
ivermectin cream canada cost
where is the best place to buy viagra online
pharmacy store viagra + cialis
cheap tadalafil no prescription
sildenafil 20 mg dosage for erectile dysfunction
can sildenafil 20 mg be used for erectile dysfunction
buy levitra at
cialis online pills
warfarin audit pharmacy
generic levitra cost
russian-federation
https://w-495.ru/
synthroid pancreas
spironolactone emotional side effects
ivermectin 90 mg
sitagliptin euglycemic dka
how long does the drug voltaren stay in your system
venlafaxine missed dose
tizanidine opiate withdrawal
tamsulosin contraindications
acarbose pancreatitis
abilify medicine
repaglinide versus nateglinide monotherapy a randomized multicenter study
natural semaglutide
remeron rls
robaxin iv
actos materiais
how long does protonix stay in your system
list
side effects buspar
augmentin dosage for children
celecoxib side effects kidney
what is baclofen 10mg used for
celexa weight gain
spisok
site
site
allopurinol contraindications
aspirin vs advil
what is aripiprazole used to treat
amitriptyline for ibs
diclofenac sodium 1% gel
depakote for bipolar
can you take flomax and viagra
para que sirve citalopram
effexor withdrawal timeline
ddavp injection cost
side effects of ezetimibe drug
diltiazem cd 120 mg
how long does flexeril stay in your urine
augmentin yeast infection
contrave breastfeeding
cozaar for high blood pressure
what does amoxicillin do
vxi.su
bactrim for strep throat
bactrim for dogs dosage chart
cephalexin smells bad
does ciprofloxacin affect birth control
spiraldynamics
does duloxetine have withdrawal symptoms
lamotrigine and fluoxetine
gabapentin viihdekäyttö
para que es cephalexin 500 mg
lexapro and sleep
buy generic viagra no prescription
batman apollo ru
cymbalta side effects first week
a patient asks the nurse how long it will take for escitalopram to be completely effective. quiz
where can i buy keflex online
Tucker Carlson - Vladimir Putin
Tucker Carlson - Vladimir Putin - 2024-02-09 Putin interview summary, full interview.
metronidazole valium
a
whats zoloft
list
list
list
list
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
link
psy
911
psy
psy
911
semaglutide 3 mg vial dosage
order semaglutide online
semaglutide tirzepatide
allopurinol lasix
xanax metformin
lisinopril arthritis
celebrex tamoxifen
can pregabalin get you high
valacyclovir sleepy
bactrim trichomoniasis
ran gabapentin
metronidazole sulphonamide
cialis professionel
ambrisentan and tadalafil combination brands
buy black cialis
black tab cialis
sildenafil 50mg
cost of viagra 100mg in australia
female viagra 100mg price in india
viagra for sale in canada
generic viagra online for sale
where can you get generic viagra
purchasing cialis online
united pharmacy tamoxifen
blue sky peptide tadalafil
can i buy over the counter viagra
viagra tablets for sale
cialis pills low price
online pharmacy generic finasteride
most reliable online pharmacy viagra
where to buy tadalafil online
viragecialis
can i buy viagra over the counter in canada
cialis vs sildenafil
online viagra tablet canada
female viagra india online
cheap viagra pills free shipping
typical cialis prescription strength
sildenafil vs vardenafil vs tadalafil
viagra prescription nz
buy cialis on line without presciption
buy viagra tesco pharmacy
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊
Python虚拟环境&pip换源 - CodeBear程序熊