So I tried to change PYTHONPATH in mac terminal and this is how it went:

>>> PYTHONPATH = "${PYTHONPATH}:~/Desktop/Python/Modules"
>>> export PYTHONPATH
File "<stdin>", line 1
export PYTHONPATH
                ^
SyntaxError: invalid syntax

What am I doing wrong?

有帮助吗?

解决方案

When you type PYTHONPATH, you are typing in a command that is meant for your shell, not necessarily the python interpreter -- that is why you're getting a syntax error. What you want to do is set the pythonpath before you start the interpreter. When you set PYTHONPATH, you essentially give python's sys module another path in which to look for modules.

So like @Blender said, you'll want to start your terminal again, and from there, you'll want to type those two last commands again.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top