Explore Courses Blog Tutorials Interview Questions
0 votes
in Python by (16.4k points)

With the help of virtualenv, I used to run many of my projects with my default python version 2.7. But, now for my new project I want to use python version 3.4

If I try running this code ,

virtualenv -p python3 test
I'm getting some error like this,
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/", line 67, in <module>
    import os
  File "/Users/user/Documents/workspace/test/test/bin/../lib/python3.4/", 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
Anyone help me to fix this problem.

1 Answer

0 votes
by (26.4k points)
edited by

Try to execute this code,

virtualenv -p python3 envname

In OP's version, there is a bug in it, you can fix the problem by running the below code:

pip install --upgrade virtualenv

Wanna learn more about python? Join our Python course and become an expert.

To know more about these topics, you can also look at the following video tutorial :

Related questions

Browse Categories