Meiping Sun
Meiping Sun

Reputation: 3

Keep getting the same SyntaxError: invalid syntax when trying to load packages using pypm

I downloaded ActivePython-2.7.2.5-win32-x86 and installed the software as instructed on the documentation. But pypm is not working at all. From the documentation, I believed that I just need this code in the IDLE (Python GUI) after successfully installing Python:

C:\> pypm install pandas 

to install and load the package. However, I kept getting the syntaxerror shown as below

ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> C:\> pypm install pyramid
SyntaxError: invalid syntax

I also get the same error message when I try to run the same code:

C:\> pypm install pandas 

in Python interactive shell as below:

ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> C:\> pypm install pyramid
  File "<stadin>", line 1
    C:\> pypm install pyramid
     ^
SyntaxError: invalid syntax

I did try to open the Python Package Manager (PyPM) to check if anything wrong there. I found the below lines in the PyPM window:

'pypm' is not recognized as an internal or external command,
operable program or hatch file.

C:\windows\system32>

I really do not know where I did wrong, I tried to uninstall ActivePython 2.7.2.5 and reinstall again several times, I still get the same error messages.

When I just type

pypm install pandas

in Python interactive shell as below:

ActivePython 2.7.2.5 (ActiveState Software Inc.) based on
Python 2.7.2 (default, Jun 24 2011, 12:21:10) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> pypm install pyramid
  File "<stadin>", line 1
    pypm install pyramid
               ^
SyntaxError: invalid syntax

Still the same error message.

I tried to uninstall ActivePython 2.7.2.5 and reinstall again several times, still get the same error messages. I am using Windows 7 operation system.

Upvotes: 0

Views: 1364

Answers (2)

NickG
NickG

Reputation: 11

I ran into the same problem. The answer given isn't completely accurate, though.

On Windows with ActivePython 2.7.8.10 recently installed, I attempted to do the same as the OP and got the same error message. I, too, was using the Python 2.7.8 shell when I encountered the problem.

The "right answer" was that in the folder for ActiveState Python 2.7, there is an icon for Python Package Manager (PyPM). Launching this icon brought up a command prompt window with the following:

PyPM 1.4.3 (Python Package Manager) brief help: Type "pypm install PACKAGE" to install a package. Type "pypm search KEYWORDS" to search for packages. Type "pypm upgrade" to upgrade installed packages.
Type "pypm help" to show full help. C:\Windows\system32>

Here, I could enter the command to run pypm and install the packages I wanted.

A point to note. This only worked on the ActiveState Python package. Other pacakges of Python don't have PyPM installed -- so you'll have to figure out how to install that first if you want to stick with other distros of python.

Upvotes: 1

user2665694
user2665694

Reputation:

You can not call

pypm install pyramid

from the Python interpreter prompt.

You have to type this from the command line console/shell.

Upvotes: 1

Related Questions