Why does “pip install” inside Python raise a SyntaxError?

后端 未结 8 811
天命终不由人
天命终不由人 2020-11-21 05:46

I\'m trying to use pip to install a package. I try to run pip install from the Python shell, but I get a SyntaxError. Why do I get this error? H

8条回答
  •  臣服心动
    2020-11-21 06:09

    Programmatically, the following currently works. I see all the answers post 10.0 and all, but none of them are the correct path for me. Within Kaggle for sure, this apporach works

    from pip._internal import main as _main
    
    package_names=['pandas'] #packages to install
    _main(['install'] + package_names + ['--upgrade']) 
    

提交回复
热议问题