简体   繁体   中英

unable to install python-dotenv in python in script running on Azure Machine Learning experiment

I created a new experiment in Azure Machine Learning to run an endpoint of a Python script. The Python script itself runs fine but then when I run the driver of the Python script, I get an error when I try to run python-dotenv .

All of these statements throw an SyntaxError: invalid syntax error :

get_ipython().system('pip install python-dotenv')
pip install --upgrade python-dotenv
pip install python-dotenv
pip install -U python-dotenv
!pip install python-dotenv

If I don't try to install python-dotenv , I get this error:

from dotenv import load_dotenv  # pip install python-dotenv
ModuleNotFoundError: No module named 'dotenv'

Instead of directly using pip install <name> you can use the python -m pip install <name>

I had tried with pip install Some times it may given the syntax error while accessing outside of the installed directory. Instead you can use python -m pip install <name> .

Make sure Your Pip version should be latest or try to update by using python.exe -m pip install --upgrade pip .

Use the below snippet to install the Python-dotenv

python -m pip install --upgrade python-dotenv
python -m pip install python-dotenv
python -m pip install -U python-dotenv
python -m !pip install python-dotenv

Refer here

Note: If my answer is helpful for you, you can accept it as answer( click on the check mark beside the answer to toggle it from greyed out to filled in.). This can be beneficial to other community members. Thank you

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM