J'ai eu une erreur de syntaxe lorsque je direnv allow
localement sur mon 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
En regardant la ligne 397 de configparser.py
,
394:try:
395: import ConfigParser
396:except ImportError:
397: import configparser as ConfigParser
En regardant cette page, il semble que Python 3.4 charge l'environnement Python 2.7, donc la compatibilité est requise. C'était ça.
J'ai frappé la commande suivante car le virtualenvwrapper
est peut-être obsolète ou manquant.
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
Entrez à nouveau dans le répertoire et essayez de charger .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
J'ai pu l'installer correctement \ (^ o ^) /