安装python模块自定义位置,PYTHONUSERBASE / virtualenv

时间:2022-11-21 00:24:07

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:

我正在尝试在Windows 7 64位上安装我自制的Python程序包。根据https://docs.djangoproject.com/en/1.5/intro/reusable-apps/上的说明,我正在运行命令:

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?

但是,我想安装到C:\ mysite。我读了很多关于几种方法的内容,但最简单最简单的方法是什么?

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

该教程说使用virtualenv。我安装了它,但从未使用它。还有这个: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

上述方法列出了3种方法。我想知道如何使用“-user”选项并自定义PYTHONUSERBASE方法

AND

The virtualenv method.

virtualenv方法。

Thanks.

1 个解决方案

#1


1  

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

首先,您需要将C:\ mysite添加到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

#1


1  

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

首先,您需要将C:\ mysite添加到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