I wrote python3.4 in .envrc with direnv and allowed it, but I got a syntax error

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

I wrote python3.4 in .envrc with direnv and allowed it, but I got a syntax error
I wrote a class in Python3 and Java
I got an error in vim and zsh in Python 3.7 series
I set the environment variable with Docker and displayed it in Python
A memo that I wrote a quicksort in Python
Building a python environment with virtualenv and direnv
I got an error when I put opencv in python3 with Raspberry Pi [Remedy]
Note that I understand the least squares algorithm. And I wrote it in Python.
I made a Python3 environment on Ubuntu with direnv.
I want to work with a robot in python.
I made a LINE BOT with Python and Heroku
[Python, ObsPy] I wrote a beach ball with Matplotlib + ObsPy
I created a stacked bar graph with matplotlib in Python and added a data label
I got stuck when trying to specify a relative path with relative_to () in python
[Introduction to system trading] I drew a Stochastic Oscillator with python and played with it ♬
Image processing with Python (I tried binarizing it into a mosaic art of 0 and 1)
I got a Value Error when using JUMAN ++ with PyKNP
I made a simple typing game with tkinter in Python
I wrote python in Japanese
Temporarily save a Python object and reuse it in another Python
It is blocked by Proxy, a connection error occurs in Python or pip, and it is retried.
I wrote a program quickly to study DI with Python ①
Associate Python Enum with a function and make it Callable
When I installed python on macOS and used it, I got an error when I put an https connection
Recursively get the Excel list in a specific folder with python and write it to Excel.
I made a server with Python socket and ssl and tried to access it from a browser
I created a class in Python and tried duck typing
I made a puzzle game (like) with Tkinter in Python
I also tried to imitate the function monad and State monad with a generator in Python
I wrote a doctest in "I tried to simulate the probability of a bingo game with Python"
Install CaboCha in Ubuntu environment and call it with Python.
I got an SSL Error when I installed Anaconda in a new environment, so I solved it (Windows10, Anaconda3-2019.10)
I made a simple circuit with Python (AND, OR, NOR, etc.)
I want to solve APG4b with Python (only 4.01 and 4.04 in Chapter 4)
I made a Nyanko tweet form with Python, Flask and Heroku
I wrote a function to load a Git extension script in Python
Draw a watercolor illusion with edge detection in Python3 and openCV3
I tried to make a periodical process with Selenium and Python
I wrote a script to extract a web page link in Python
I want to create a pipfile and reflect it in docker
I made a segment tree with python, so I will introduce it
[Python] I wrote a REST API using AWS API Gateway and Lambda.
I made a chatbot with Tensor2Tensor and this time it worked
I made a fortune with Python.
I wrote Fizz Buzz in Python
I played with PyQt5 and Python3
I wrote the queue in Python
I made a daemon with Python
I wrote the stack in Python
I wrote a tri-tree that can be used for high-speed dictionary implementation in D language and Python.
Note that I understand the algorithm of the machine learning naive Bayes classifier. And I wrote it in Python.
I ran GhostScript with python, split the PDF into pages, and converted it to a JPEG image.
2. Make a decision tree from 0 with Python and understand it (2. Python program basics)
I wrote a code to convert quaternions to z-y-x Euler angles in Python
I want to do it with Python lambda Django, but I will stop
I want to tweet on Twitter with Python, but I'm addicted to it
Deploy a Python app on Google App Engine and integrate it with GitHub
I got an SSL related error with pip install, so I solved it
I made a Discord bot in Python that translates when it reacts
[Python] I forcibly wrote a short Perlin noise generation function in Numpy.
I get a Python No module named'encodings' error with the aws command