No module named azure in pyvenv
See original GitHub issueDescription
Installing azure-cli to a Python 3 venv produces invalid az
command.
$ python3.6 -m venv ~/azure
$ ~/azure/bin/pip install -q azure-cli
$ ~/azure/bin/python --version
Python 3.6.1
$ ~/azure/bin/az
/usr/local/opt/python/bin/python2.7: No module named azure
Whatever magic the az script is attempting to do is apparently not detecting the virtual environment and is instead invoking an old Python from a different environment where azure is not installed.
It’s possible this installation method isn’t supported, but as a Python engineer, I would have expected it to work.
Environment summary
Install Method: How did you install the CLI? (e.g. pip, interactive script, apt-get, Docker, MSI, nightly)
Answer here: pip
CLI Version: What version of the CLI and modules are installed? (Use az --version
)
Answer here: 2.0.10
OS Version: What OS and version are you using?
Answer here: macOS 10.12.5
Shell Type: What shell are you using? (e.g. bash, cmd.exe, Bash on Windows)
Answer here: zsh
Issue Analytics
- State:
- Created 6 years ago
- Reactions:4
- Comments:9 (4 by maintainers)
Top GitHub Comments
Using
/usr/bin/env python
doesn’t work either. Replacing it with$DIR/python
does work, however:I have both python and python3 environments installed. Chose toinstall azure-cli to python3. Even if you have alias pointing python to python3 did not help. The command $ cat $(which az) @derekbekoe pointed out solved the issue. In my case I edit the az file as simply changing the python in the last line to python3:
python3 above will automatically point to /usr/bin/python3 and solved the issue.