Python 在 anaconda 上找不到 azure.mgmt.datafactory
Python on anaconda cannot find azure.mgmt.datafactory
我正在尝试 运行 本教程
https://docs.microsoft.com/en-US/azure/data-factory/quickstart-create-data-factory-python
但是我安装包失败了。我尝试了几次安装,但在尝试 运行 from azure.mgmt.datafactory import DataFactoryManagementClient
.
时,我一直收到错误 No module named 'azure.mgmt.datafactory'
我正在使用 anaconda 和 windows 10。
我尝试 运行使用推荐的 anaconda 包 https://anaconda.org/anaconda/azure and https://anaconda.org/clinicalgraphics/azure-mgmt-resource under a python 3.5 environment and I also tried to manually install everything from github (https://github.com/Azure/azure-sdk-for-python) 使用
git clone git://github.com/Azure/azure-sdk-for-python.git
cd azure-sdk-for-python
python setup.py install
在正常 (Python 3.6) 和新的(Python 3.5,使用 Anaconda version with Python 3.5)环境中。 None 有效。
我错过了什么?
(注意 from azure.mgmt.resource import ResourceManagementClient
在 anaconda 安装下运行良好)
编辑
第一次响应后,我运行从powershell
执行以下命令
pip install azure-mgmt-resource
pip install azure-mgmt-datafactory
pip install azure-mgmt
结果是 ModuleNotFoundError: No module named 'azure.mgmt'
卸载这三个包并安装 azure-mgmt 作为第一个包也没有解决问题。但是,我不知道如何从 python setup.py install
中卸载手动安装的软件包,这仍然可能是一个问题。
您在 powershell/cmd 中尝试过 pip 安装吗?
pip install azure-mgmt-datafactory
更新(简的回答):
pip freeze > requirements.txt
pip uninstall -r requirements.txt
python -m pip install azure-common
python -m pip install azure-mgmt
python -m pip install azure-mgmt-datafactory (this might not be needed as it comes with azure-mgmt)
好的,这就是我如何让所需的 azure 库正常工作(感谢 Saul Cruy,他给了我灵感)
使用这个 post What is the easiest way to remove all packages installed by pip?,我在 PowerShell 中创建了一个需求文件
pip freeze > requirements.txt
在这个文件中,我手动只保留了带有天蓝色的条目。
然后,我删除了文件中的所有包
pip uninstall -r requirements.txt
上面的步骤重复了两次,因为在第一次删除时,一些 azure 包仍然存在。
然后,我 运行(全部在 PowerShell 中,按此顺序)
python -m pip install azure-common
python -m pip install azure-mgmt
python -m pip install azure-mgmt-datafactory
原因可能(!)是使用 conda
命令在 anaconda 控制台中安装包会导致依赖关系混乱(我在 conda 环境中尝试了类似的方法,因为这似乎是个好主意将 azure 包与其他包分开,但没有成功)。
我正在尝试 运行 本教程
https://docs.microsoft.com/en-US/azure/data-factory/quickstart-create-data-factory-python
但是我安装包失败了。我尝试了几次安装,但在尝试 运行 from azure.mgmt.datafactory import DataFactoryManagementClient
.
No module named 'azure.mgmt.datafactory'
我正在使用 anaconda 和 windows 10。
我尝试 运行使用推荐的 anaconda 包 https://anaconda.org/anaconda/azure and https://anaconda.org/clinicalgraphics/azure-mgmt-resource under a python 3.5 environment and I also tried to manually install everything from github (https://github.com/Azure/azure-sdk-for-python) 使用
git clone git://github.com/Azure/azure-sdk-for-python.git
cd azure-sdk-for-python
python setup.py install
在正常 (Python 3.6) 和新的(Python 3.5,使用 Anaconda version with Python 3.5)环境中。 None 有效。
我错过了什么?
(注意 from azure.mgmt.resource import ResourceManagementClient
在 anaconda 安装下运行良好)
编辑
第一次响应后,我运行从powershell
执行以下命令 pip install azure-mgmt-resource
pip install azure-mgmt-datafactory
pip install azure-mgmt
结果是 ModuleNotFoundError: No module named 'azure.mgmt'
卸载这三个包并安装 azure-mgmt 作为第一个包也没有解决问题。但是,我不知道如何从 python setup.py install
中卸载手动安装的软件包,这仍然可能是一个问题。
您在 powershell/cmd 中尝试过 pip 安装吗?
pip install azure-mgmt-datafactory
更新(简的回答):
pip freeze > requirements.txt
pip uninstall -r requirements.txt
python -m pip install azure-common
python -m pip install azure-mgmt
python -m pip install azure-mgmt-datafactory (this might not be needed as it comes with azure-mgmt)
好的,这就是我如何让所需的 azure 库正常工作(感谢 Saul Cruy,他给了我灵感)
使用这个 post What is the easiest way to remove all packages installed by pip?,我在 PowerShell 中创建了一个需求文件
pip freeze > requirements.txt
在这个文件中,我手动只保留了带有天蓝色的条目。 然后,我删除了文件中的所有包
pip uninstall -r requirements.txt
上面的步骤重复了两次,因为在第一次删除时,一些 azure 包仍然存在。
然后,我 运行(全部在 PowerShell 中,按此顺序)
python -m pip install azure-common
python -m pip install azure-mgmt
python -m pip install azure-mgmt-datafactory
原因可能(!)是使用 conda
命令在 anaconda 控制台中安装包会导致依赖关系混乱(我在 conda 环境中尝试了类似的方法,因为这似乎是个好主意将 azure 包与其他包分开,但没有成功)。