‘wpeno17 Using Python in vitvaleny - Stack Overtow
Using Python 3 in virtualenv
Using virualeny, Iran my projets with he taut version of Pytnen (2.7) On ane projet, need tous
Pyinon 3.4
lusod avon sorta pytnend to install ton my Mac, Now, how do | reals a virualony that uses the row
0.9, sudo Viva enveython3
hy
Iget
EF mung emaentrom nomi
Sree eae
ici ia
RSet ae ona
eee TS care
ea ey
pte pyr vrlee
An, Sits Prometheus
1 yay oy san teeny eevee ye a set
16 Answers
simply ran
Update after OP's et:
‘There we
by runing
bug inthe OP's version of vitualny, as deserved here, The problem was fed
ethos tay 244 91038 ssvorotiny 26 818
a.
2 Sea a is 9 isa Pa aS a ah. ke ea
2 eestor you shoul ad hs bug poo your anewor 0 fi af contaos sopyo8 May 24 4
{The vitulony upgrade worked, bul for some eat alo had o be ep bout yon executable wth
hps:istackoverfow.com/questons/238427 13using-python 3.in-vitualeny
6‘wpeno17 Using Python in vitvaleny - Stack Overtow
‘irtsleny op Staion pytens)enane ~samins Now 76 22°95
“Thanks or he say stop. previous dé away aroun procedure an sremsd up my nave
2 tai pestle oj change the cunt anitrant yon naar rater thn eng om
tretorreni? = Cris Pasar sg 2048 3730
Dynan 3 has a bulin support or vitual envranmants- ven. Iimght be better to se that
Instead. Refering othe docs:
Creaton of virtual environments dane by executing the pyverw set:
Update for Python 3.6 and newer
[As pawciobiel correctly comments, pen is clsprecates as of Python 3.8 and the new way ls
pythons oven /poth/tonenvirtlerireoent
ety 291210 nonce May 1°15 819.09
BS lcernnins cten
aor OT
hoe you re caren pt tr ook wth pang wih yon 353 Ines Sp
1 have at ound any fomaton conti he oeston eed cones oclale mas emoved a an
‘pia owen? sar wears o tron opr eae
work he charm = Sux Oot 2116 t 6:32
Pytnon 38 oocsnsI Nor 19°16 a OF
‘wow fpotvv2 sine ren sip hasbeen depres of
Sung the est aracond thn 3 on rae and pytand =n ven fath/3 ao Nea. err
Camara '[ Jastn/a/oinpyenens', "cle “asurepip:, =cagrese' fo") eetarnat
Saniora exis Am ining someting? Wine =oithus-pip oplon ont rts tear wh
Sebvataldeactvate spn comet — ret Mar 63 218
Insta prorequistes,
creat
Python’ based virtual envranmont, Oponaly enable ~-syzen-site
‘Set ino the vrual envionment.
Install ether requirements using tp package manager
\wnen working on mutpl python projects simuttancously tis usually recommended to instal
‘common packages ke oserg> globally and then reuse them in vitualenes.
Using this technique saves alt of time spent on fetching packages andinstaling them, apart
‘fom consuming minimal sk space and network bandwi
suo pind stall osags
eta 258188 weed Mar 191632035
Sendesp
hps:istackoverfow.com/questons/238427 13using-python 3.in-vitualeny‘wpeno17 Using Python in vitvaleny - Stack Overtow
1 applets OSX it wares (ecap dla use apt-get but br) she Ost 31 at 45,
Ivtied py and its very handy fr switching python versions (global, localn folder or inthe
vial
‘hon instal Python version you want
and simply crete vitualene wih pat o needed interpreter version:
‘virtuale op /uzers/sobny/.oyenvvertone/2.5./tin/ython 5 ayene
‘That’, check the version
“There are also plugin for pyeny pyenv-vrusley but tale work for me somehow,
Johnna
has 9
itseans at your metas aque o rest sn thon enorme. Can par work th vita
"pln ange my pion aon wheneves ae? = Cnrta Pao lg 206 5217
virrslany python iuer/atnoython cane of woes
worked forme,
‘ethan
Lived patbutis sad the execuabie pythons (ren ~-pytareythan) does no ext, whet woul!
yoda" | ward io tam al py’ ut wet uate ta wa a goad ies ory ys wos et
anise of hich tan vorsn amusing creator hug 28 at 27
tars wore for mean mae wih mhvrusane.— Syke et 7 "Bat 14:48
yinon now comes wit sown implementation of vital envionment, by the name of venv™ 1
would suggest using that, instead of vtualem.
Quoting from very - docs,
Deprocated since version 3.6: pyverv was the recommended tol for creating vtual
‘enwronmants for Python 2. and 2.4, and fs deprecat in Python 3.6,
Changed in version 3.5: The uso of venv is now recomme
environments,
1 for creating virtual
For windows nitate very on some projet open em
(Would suggest using double quot around droctory path ifitcontans any spaces. Ex:"C:My
DexlSpaced Diectory/Something)
‘Once venv is setup, you wil se some new folders inside your project siectry. One of them
‘would be "Sept
‘To activate ar invoke verw you need
E> even \Seigteactvate ba
hps:istackoverfow.com/questons/238427 13using-python 3.in-vitualeny‘wpeno17 Using Python in vitvaleny - Stack Overtow
You can deactivate avira environment by typing "deactivate" in your shel. With this. you are
ow reac to instal your project specie varies, which wl reside under ho folder "Li".
eat
‘The sconaio which wil be eiscussed below is
‘ot what originally asked, just adding this in case sormecre use vscode with python extonsion
In cago, you use vs code with its python extension, you might face anise wit its pnt
\hien points othe global instalation. In ths case, pyint wot be able to see the modules that
‘210 installed in your vital environment and hence will aw errors while importing
Hote ts simple method to get past his.
‘We are basically activating the envzanment fist and thn invoking vs-code go that pyfnt stats
within the environment and can see al local packages,
td ape 76 89997 aneaced Fb 61599
Bhze
ise wirtasten tr dat-dy eof til envenmens (orton le) bat feral elo of
it anvrnmansin pytions. see on way fund a wr Goble Rp 2 1008
In adi tothe other answers, | recommend checking what instance of vituslenv you are
executing
If this tums up something in fustocabin, then itis possible even tkely - that you installed
viwalo (pasialy using an instance of easy_tools or pip) without using your system's
‘package manager (brew in OP's case). Ths was my problem
‘Years ago - won| was oven more ignorant -I had installed Wtualony and it wats masking my
systems package provided vtvalerw
‘Afr removing this ol, broken vitulony, my problams went away.
Bhim so a
Ifyou install python (sre instal pythons} along with Vitualeny burt, you ean than do
nevirtuoent p Santen pythra) ere nme
Cf cours, 1 know vitualeny burt is just a wrapper, but thas served me wel over he years,
reducing some learning curves,
Bx
are ew
‘On Mac has o do the folowing to ge io work
Siyier
‘irtsteny —-pyetosfuer/Ioc/stn/oythona GIBTUAL EN NOK this Willa pythond path for
your vatual onviroment.
satiny 725 anouee apr 41427
Harek Gai
hps:istackoverfow.com/questons/238427 13using-python 3.in-vitualeny‘wpeno17 Using Python in vitvaleny - Stack Overtow
IRworked for me
virtsleny ~-eo-stte-pacages “-eiartbte -pJun/binpytnond ~/.virasene/y3
DasasaZanzane
Ite all the above stu, al dant work, So 98a brute force, just re-installed the anaconda,
rednstaled the wituaeny.. and worked
eas-tacsook-ra:~ stanafors pip soetll virtulene
unloning virzlens15.0.3:p/2.0)3.nareany atl (2.51)
“or ees
Nepcter tbe’ Maca naman toc hott tony eee her
Inpe-toctonk-roryehon staat
‘ae Maden
For those having roubles while working with Anaconda (Pyton 3).
You could use
end crete - nom of Jour sirtaslenypythoepythen version
‘To activate the environment (Linux, MacOS)
For Windows
| wanted to keep python 2.7.5 as default vorsion on Centos 7 but have python 3.6.1 ina wstual
environment running alongside other viual environments in python 2,
ound the below tnk he best solution for the newest pybran version (python 3.6.1)
tps "now.o-salhand-so-up aocal
stgramek Overfow te lem, share knowledge, and bul fatale platforms Bute Basic)
stops ¢
1. Insta! pythons. not present for your platform
2. stl python.xcdovel for your platform
5. Create viral envitnmentin python 3x (for example §python3.6-m venvvrenv test 3
y
4, Actate the testenvtonment for python 3.x for example source
weeny test pabiniactvate)
5. Install the packages wich you want to use in your new python 3 virual environment and
which are Supparte (for example pip Install Django==1.11.2)
Bhocrmmn
| got the same ertor due to it being a conti with minconda install 0 when you tye "which
‘etalon and youve installed minconda and its pointing to at install you can either
hps:istackoverfow.com/questons/238427 13using-python 3.in-vitualeny
S Googie‘wpeno17 Using Python in vitvaleny - Stack Overtow
remove it your ike me and havent moved tit yet or change your environment variable to
onto the instal you want.
PrncessPa
[ina the same catox message briskers solution didnot work in my case. Instead this
S prtond