英文:
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.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论