lundi 29 juin 2015

install python module in custom directory on windows


I am trying to install pip on my company's windows machine, but I don't have admin permission, so I have to install it else where.

When I set the path in prefix:

python setup.py install --prefix="C:\Developers\lib"

There goes the error:

running install
Checking .pth file support in C:\Developers\pythonLib\Lib\site-packages\
C:\Program Files (x86)\Python27\pythonw.exe -E -c pass
TEST FAILED: C:\Developers\pythonLib\Lib\site-packages\ does NOT support .pth files
error: bad install directory or PYTHONPATH

You are attempting to install a package to a directory that is not
on PYTHONPATH and which Python does not read ".pth" files from.  The
installation directory you specified (via --install-dir, --prefix, or
the distutils default setting) was:
    C:\Developers\lib\Lib\site-packages\
and your PYTHONPATH environment variable currently contains:

''

Here are some of your options for correcting the problem:

* You can choose a different installation directory, i.e., one that is
  on PYTHONPATH or supports .pth files

* You can add the installation directory to the PYTHONPATH environment
  variable.  (It must then also be on PYTHONPATH whenever you run
  Python and want to use the package(s) you are installing.)

* You can set up the installation directory to support ".pth" files by
  using one of the approaches described here:

  http://ift.tt/KJcLvw

Please make the appropriate changes for your system and try again.

Do you have any suggestions? Thanks!

UPDATE:

I don't have the permission to edit environment variables, so I thought I cannot edit the Pythonpath. but I noticed that I can use

set PYTHONPATH=C:\Developers\pythonLib\Lib\site-packages

, and then

python setup.py install --prefix="C:Developers\pythonLib"

to solve the issue.


Aucun commentaire:

Enregistrer un commentaire