简体   繁体   中英

install python module custom location, PYTHONUSERBASE / virtualenv

I am trying to install a Python package I made into a custom location on Windows 7 64 bit. According the instructions on https://docs.djangoproject.com/en/1.5/intro/reusable-apps/ I am running the command:

python setup.py install --user

Now this installs fine. It installs to the default location of

C:\Users\User1\AppData\Roaming\Python\Python27\site-packages

However, I want to install to C:\\mysite . I read a lot about several ways, but what would be the easiest and simplest method?

The tutorial says use virtualenv. I have installed that and never used it though. Also there is this: http://pythonhosted.org/distribute/easy_install.html#custom-installation-locations

The above method lists 3 ways to do this. I would like to know how to use the "-user" option and customize PYTHONUSERBASE method

AND

The virtualenv method.

Thanks.

First of all, you need to add C:\\mysite to your PYTHONPATH.

Then, when installing a new module, you do:

PYTHONPATH=C:\mysite python setup.py install --install-lib C:\mysite

Source: http://wiki.alwaysdata.com/wiki/Installing_a_Python_module

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM