[Tutor] trouble installing library

eryksun eryksun at gmail.com
Wed Apr 24 04:01:44 CEST 2013


On Tue, Apr 23, 2013 at 5:59 PM, Lolo Lolo <losermeloser at yahoo.com> wrote:
> found the activate file inside a folder name Scripts (instead of bin) and
> and tried the same command, but now i get this error:
>
>   File "Scripts/activate", line 4
>     deactivate () {
>                   ^
> SyntaxError: invalid syntax

Run Scripts\activate.bat if your shell is cmd, or Scripts\activate.ps1
if you're using PowerShell. These are shell scripts. Do not run them
with Python.

----

>From the outset, use an elevated console and make sure you use the
desired version of Python when you install distribute/setuptools (use
distribute in 3.x). Be explicit here. For example, if 2.7 is in
C:\Python27, run

    CWD\>C:\Python27\python setup.py install

CWD is substituting here for your actual "current working directory",
as displayed in the default cmd shell prompt.

Or use pylauncher (installed with 3.3):

    CWD\>py -2.7 setup.py install

Then install pip with easy_install:

    CWD\>C:\Python27\Scripts\easy_install -Z pip

Finally virtualenv:

    CWD\>C:\Python27\Scripts\pip install virtualenv

If you're using Python 3.3, you may instead want to use the new
virtual environment module "venv" described in PEP 405:

http://www.python.org/dev/peps/pep-0405

Once the system-wide installation is finished you no longer need to
(and really shouldn't) work in an elevated console.

----

Generally I recommend using pip instead of easy_install. However, if
you have exe installers for pre-compiled packages, you can install
them with easy_install, at least if the installer is built with
distutils. pip can't do this. For example:

    (gmapenv) CWD\>easy_install -Z package-XXX-py2.7.exe

Note that "(gmapenv)" in the prompt signals that the "gmapenv" virtual
environment is active. Run "deactivate" to quit the virtual
environment and restore the original PROMPT and PATH.


More information about the Tutor mailing list