Installing python packages in Mac.

huangapple go评论49阅读模式
英文:

Installing python pacakages in Mac

问题

我是Python的新用户,正在尝试在Visual Code中使用Anaconda安装一个包。我输入以下代码:

pip install pandas-dedupe

但我收到了这个错误:

/Users/nathang./anaconda3/bin/python /Users/nathang./Desktop/python/example.py
  File "/Users/nathang./Desktop/python/example.py", line 1
    pip install pandas-dedupe
        ^^^^^^^
SyntaxError: invalid syntax
(base) nathang.@MacBook-Pro python % 

我已经尝试了几个小时,任何帮助将不胜感激。

英文:

I am a new user to python and I am trying to install a package in Visual Code using anaconda. I type in the following code

pip install pandas-dedupe

But I receive this error

/Users/nathang./anaconda3/bin/python /Users/nathang./Desktop/python/example.py
  File "/Users/nathang./Desktop/python/example.py", line 1
    pip install pandas-dedupe
        ^^^^^^^
SyntaxError: invalid syntax
(base) nathang.@MacBook-Pro python %

Any help would be appreciated as I have been trying to figure this out for a few hours.

答案1

得分: 1

pip 应该在终端中使用,您正在将其键入到脚本 (example.py) 中。

在 VSCode 中,按下<kbd>⌘</kbd>+<kbd>J</kbd>(在 Windows 上是<kbd>Ctrl</kbd>+<kbd>J</kbd>),这将在窗口底部打开一个面板。点击 终端 选项卡,在打开的终端中键入您的命令 pip install pandas-dedupe

英文:

pip is meant to be used from the terminal, you are typing it into a script (example.py).

From within VSCode press <kbd>⌘</kbd>+<kbd>J</kbd> (<kbd>Ctrl</kbd>+<kbd>J</kbd> on Windows) which will open a panel on the bottom of the window. Press the Terminal tab and type your command pip install pandas-dedupe in the terminal which opens.

huangapple
  • 本文由 发表于 2023年5月22日 01:37:34
  • 转载请务必保留本文链接:https://go.coder-hub.com/76301153.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定