简体   繁体   中英

Installing virtualenv

I installed Python 3.7.1 using home-brew, and on the command line typing python returns the default python 2.7.10 and python3 gives the home-brew installed version. Then using

python3 -m pip install --user numpy scipy matplotlib

I installed the required packages. Now what I understand is that to use the home-brew version python I have to always use python3 and the required packages are installed inside python 3's lib folder.

I want to install virtual env correctly. I want to know what command should I use if I want it to be usable with python3?

You don't need to install virtual env because venv module is included in Python 3 standard library.

To create a virtualenv under .venv subdirectory of the current working directory:

 python3 -m venv .venv

From my understanding you want to create python3 environments. First install virtualenv using pip.
pip install virtualenv
Then you can create a python3 environment like this:
virtualenv -p python3 env_name

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