Closed kurtgn closed 9 years ago
There are two separate issues here I think. For the first issue, with mkvirtualenv, it looks like you probably have incompatible version. Try the following and let me know how it works:
mkvirtualenv --python `which python3` env_name
This should cause virtualenv to use python 3.
If that doesn't work, I would say it maybe easier to use homebrew to get your python environment setup correctly. Here is a link to a pretty good guide to do that:
http://hackercodex.com/guide/python-development-environment-on-mac-osx/
Let me know how it goes.
Thanks, I tried using both ways but the result is the same: when I try to create virtualenv it still gives the same error:
File "/Users/1111/.virtualenvs/py3/bin/../lib/python3.4/importlib/util.py", line 12, in <module>
from contextlib import contextmanager
ImportError: No module named 'contextlib'
ERROR: The executable py3/bin/python3 is not functioning
However, I came up with a workaround for this. I opened the Python package and found the utils.py
file that was causing trouble, put contextlib.py
in the same folder and added this folder to the system path directly from the utils.py
:
...
from ._bootstrap import spec_from_file_location
from ._bootstrap import _resolve_name
from ._bootstrap import _find_spec
import os
import sys
sys.path.append(os.path.realpath(os.path.dirname(__file__)))
from contextlib import contextmanager
import functools
import sys
import warnings
...
and this helped create the virtualenv. Hope this won't bite me in the ass somewhere down the road.
Hi,
I am now at the migrating to Python 3 stage. I am on Mavericks, and I installed Python 3.4 from https://www.python.org/downloads. When I do
mkvirtualenv py3
I get thisI googled a bit and found
python3 -m venv py3
command. This worked. But then, when installing stuff fromrequirements.txt
, I got thishowever, I do have setuptools:
Please help. Stackoverflow keeps being silent, and I'm stuck. Thanks!