I got a syntax error when I direnv allow
locally on my Mac.
wakana-no-MacBook-Pro:Documents wakanayoshizawa$ cd test/
direnv: loading .envrc
Running virtualenv with interpreter /Users/wakanayoshizawa/.pythonz/pythons/CPython-3.4.3/bin/python3
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 37, in <module>
import ConfigParser
ImportError: No module named 'ConfigParser'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/local/lib/python2.7/site-packages/virtualenv.py", line 39, in <module>
import configparser as ConfigParser
File "/usr/local/lib/python2.7/site-packages/configparser.py", line 397
_KEYCRE = re.compile(ur"%\(([^)]+)\)s")
^
SyntaxError: invalid syntax
direnv: error exit status 1
Looking at line 397 of configparser.py
,
394:try:
395: import ConfigParser
396:except ImportError:
397: import configparser as ConfigParser
Looking at this page, it seems that Python 3.4 is loading the Python 2.7 environment, so compatibility is required. It was that.
I hit the following command because the virtualenvwrapper
may be out of date or missing.
sudo pip install -U virtualenvwrapper
wakana-no-MacBook-Pro:Documents wakanayoshizawa$ sudo pip install -U virtualenvwrapper
Password:
The directory '/Users/wakanayoshizawa/Library/Caches/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/Users/wakanayoshizawa/Library/Caches/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Requirement already up-to-date: virtualenvwrapper in /usr/local/lib/python2.7/site-packages
Collecting virtualenv (from virtualenvwrapper)
Downloading virtualenv-14.0.6-py2.py3-none-any.whl (1.8MB)
100% |████████████████████████████████| 1.8MB 274kB/s
Requirement already up-to-date: virtualenv-clone in /usr/local/lib/python2.7/site-packages (from virtualenvwrapper)
Collecting stevedore (from virtualenvwrapper)
Downloading stevedore-1.11.0-py2.py3-none-any.whl
Collecting pbr>=1.6 (from stevedore->virtualenvwrapper)
Downloading pbr-1.8.1-py2.py3-none-any.whl (89kB)
100% |████████████████████████████████| 90kB 2.5MB/s
Requirement already up-to-date: six>=1.9.0 in /usr/local/lib/python2.7/site-packages (from stevedore->virtualenvwrapper)
Installing collected packages: virtualenv, pbr, stevedore
Found existing installation: virtualenv 13.1.2
Uninstalling virtualenv-13.1.2:
Successfully uninstalled virtualenv-13.1.2
Found existing installation: pbr 1.8.0
Uninstalling pbr-1.8.0:
Successfully uninstalled pbr-1.8.0
Found existing installation: stevedore 1.8.0
Uninstalling stevedore-1.8.0:
Successfully uninstalled stevedore-1.8.0
Successfully installed pbr-1.8.1 stevedore-1.11.0 virtualenv-14.0.6
Enter the directory again and try loading .envrc
.
wakana-no-MacBook-Pro:Documents wakanayoshizawa$ cd test/
direnv: loading .envrc
Running virtualenv with interpreter /Users/wakanayoshizawa/.pythonz/pythons/CPython-3.4.3/bin/python3
Using base prefix '/Users/wakanayoshizawa/.pythonz/pythons/CPython-3.4.3'
New python executable in /Users/wakanayoshizawa/Documents/test/.direnv/python-3.4.3/bin/python3
Also creating executable in /Users/wakanayoshizawa/Documents/test/.direnv/python-3.4.3/bin/python
Installing setuptools, pip, wheel...done.
direnv: export +VIRTUAL_ENV ~PATH
I was able to install it properly \ (^ o ^) /
Recommended Posts