簡體   English   中英

使用Pip將Test Python軟件包安裝在其他目錄中

[英]Install Test Python Package in Different directory Using Pip

我有一個在生產中使用的python distutils模塊。 我在虛擬環境中安裝了該生產模塊。 但是,我希望能夠在生產環境中安裝之前測試升級。 我還試圖避免創建第二個虛擬環境。 因此,我嘗試了以下方法:

# inside my virtualenv
# checkout master of my repo
git clone git+git://github.com/myrepo
cd myrepo
# create directory where my testing install will live
mkdir testinstall
# prepend my testing install to the PYTHONPATH to over-ride the
# production install of my repo
export PYTHONPATH=$PWD/testinstall/lib/python2.7/site-packages:$PYTHONPATH
# install my local package with pip into the test area
pip install --prefix=$PWD/testinstall .

在這種情況下,我從pip得到錯誤:

Requirement already satisfied from /path/to/production/myrepo

如果我用

pip install --upgrade --prefix=$PWD/testinstall

pip繼續從/path/to/production/myrepo卸載生產版本,並在testinstall區域中安裝我的測試版本。

任何想法如何強制點子以這種方式安裝?

我只會使用新的venv,但如果您確實不能使用,請使用-t (目標)選項。

pip3 install --upgrade -t my_new_directory

嘗試用這種方式代替

pip install --target=d:\somewhere\other\than\the\default package_name

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM