简体   繁体   中英

How to active a virtualenv with pyenv installed

I use pyenv for handling my python versions. I also use virtualenv for creating my virtual environments. In a new project, I made a new virtual environment with python -m venv venv to make a directory called venv that has a fresh python 3.6. I then did source venv/bin/activate expecting that to make venv/bin/python to be my default python from this directory, but when I do command -v python , I am told that /Users/TheStrangeQuark/.pyenv/shims/python is still the path. I also checked with python -c "import sys; print(sys.executable)" and was printed with /Users/jhuneau/.pyenv/versions/3.6.2/bin/python .

Why is source venv/bin/activate not working to set the python executable in this directory to use the virtual environment?

I think you should try:

source venv/bin/activate

instead of

source venv/bin/active

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM