Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in Python by (47.6k points)

Using virtualenv, I run my projects with the default version of Python (2.7). On one project, I need to use Python 3.4.

I used brew install python3 to install it on my Mac. Now, how do I create a virtualenv that uses the new version?

e.g. sudo virtualenv envPython3

If I try:

virtualenv -p python3 test

I get:

Running virtualenv with interpreter /usr/local/bin/python3 Using base prefix '/usr/local/Cellar/python3/3.4.0_1/Frameworks/Python.framework/Versions/3.4' New python executable in test/bin/python3.4 Also creating executable in test/bin/python Failed to import the site module Traceback (most recent call last): File "/Users/user/Documents/workspace/test/test/bin/../lib/python3.4/site.py", line 67, in <module> import os File "/Users/user/Documents/workspace/test/test/bin/../lib/python3.4/os.py", line 634, in <module> from _collections_abc import MutableMapping ImportError: No module named '_collections_abc' ERROR: The executable test/bin/python3.4 is not functioning ERROR: It thinks sys.prefix is '/Users/user/Documents/workspace/test' (should be '/Users/user/Documents/workspace/test/test') ERROR: virtualenv is not compatible with this system or executable

1 Answer

0 votes
by (106k points)

You can simply run the below-mentioned command:-

virtualenv -p python3 envname

To know more about this you can have a look at the following video tutorial:-

Related questions

0 votes
1 answer
asked Nov 21, 2020 in Python by laddulakshana (12.7k points)
0 votes
1 answer
0 votes
1 answer
0 votes
1 answer
asked Jul 2, 2019 in Python by Sammy (47.6k points)

Browse Categories

...