是否可以使用本地文件系统中的pip安装软件包?
我已经运行python setup.py sdist了我的包,它创建了相应的tar.gz文件.该文件存储在我的系统中/srv/pkg/mypackage/mypackage-0.1.0.tar.gz.
现在,在虚拟环境中,我想安装来自pypi或来自特定本地位置的软件包/srv/pkg.
这可能吗?
PS
我知道我可以指定pip install /srv/pkg/mypackage/mypackage-0.1.0.tar.gz.这将有效,但我正在谈论/srv/pkg如果我打字,使用该位置作为点子搜索的另一个地方pip install mypackage.
下载python包的最佳方法是什么?它是pypi的依赖关系,可以在另一台机器上进行离线安装?使用pip或easy_install有什么简单的方法吗?我正在尝试在没有连接到互联网的FreeBSD盒子上安装请求库.
如何使用pip命令从requirements.txt文件升级所有python包?
试过下面的命令
$ pip install --upgrade -r requirements.txt
Run Code Online (Sandbox Code Playgroud)
因为,python包后缀为版本号(Django==1.5.1),它们似乎没有升级.有没有比手动编辑requirements.txt文件更好的方法?
编辑
正如Andy在他的回答包中提到的那样固定到特定版本,因此无法通过pip命令升级包.
但是,我们可以pip-tools使用以下命令实现此目的.
$ pip-review --auto
Run Code Online (Sandbox Code Playgroud)
这将自动从requirements.txt升级所有包(确保pip-tools使用pip install命令安装).
我是python的新手.最近我得到了一个由python编写的项目,它需要一些安装.我运行下面的命令安装但出错了.
# pip install requirements.txt
Collecting requirements.txt
Could not find a version that satisfies the requirement requirements.txt (from versions: )
No matching distribution found for requirements.txt
Run Code Online (Sandbox Code Playgroud)
我在谷歌搜索并找到了这个链接,http://stackoverflow.com/questions/28167987/python-pip-trouble-installing-from-requirements-txt但我不太明白该帖子中的解决方案.
以下是我的requirements.txt文件:
# cat requirements.txt
ordereddict==1.1
argparse==1.2.1
python-dateutil==2.2
matplotlib==1.3.1
nose==1.3.0
numpy==1.8.0
pymongo==3.3.0
psutil>=2.0
Run Code Online (Sandbox Code Playgroud)
有没有一种简单的方法来安装这个python项目中所有必需的依赖项?
EDIT1
以下是输出pip3 install -r requirements.txt.
# pip3 install -r requirements.txt
Requirement already satisfied: ordereddict==1.1 in /usr/local/lib/python3.5/dist-packages (from -r requirements.txt (line 1))
Collecting argparse==1.2.1 (from -r requirements.txt (line 2))
Using cached argparse-1.2.1.tar.gz
Collecting python-dateutil==2.2 (from -r requirements.txt …Run Code Online (Sandbox Code Playgroud) 我有一个requirements.txt包含所有依赖项的文件,但未正确处理:
一段时间后pip install -r requirements.txt,我得到以下内容pip freeze:
argparse==1.2.1
wsgiref==0.1.2
Run Code Online (Sandbox Code Playgroud)
但是当我做一个pip安装:
numpy==1.6.2
Django==1.4.2
django-tastypie==0.9.14
pyes==0.19.1
Run Code Online (Sandbox Code Playgroud)
然后运行我的pip install -r requirements.txt.然后它工作.
这是我的requirements.txt包含:
numpy==1.6.2
Django==1.4.2
django-tastypie==0.9.14
urllib3==1.5
pyes==0.19.1
BeautifulSoup==3.2.1
MySQL-python==1.2.3
IMAPClient==0.9.1
Jinja2==2.6
Pillow==2.0.0
amqp==1.0.9
anyjson==0.3.3
billiard==2.7.3.22
celery==3.0.16
django-celery==3.0.11
django-compressor==1.3
django-concurrency
django-extensions==1.1.1
https://codeload.github.com/toastdriven/django-haystack/zip/master#egg=django-haystack
django-model-utils==1.2.0
django-multiforloop==0.2.1
django-social-auth==0.7.22
html5lib==0.95
httplib2==0.8
kombu==2.5.7
logilab-astng==0.24.2
logilab-common==0.59.0
oauth2==1.5.211
ordereddict==1.1
pycrypto==2.6
pylint==0.27.0
python-dateutil==1.5
python-openid==2.2.5
pytz==2013b
six==1.3.0
unittest2==0.5.1
wsgiref==0.1.2
xlrd==0.9.0
xmltodict==0.4.6
django-storages>=1.1.8
boto==2.8.0
lxml==3.1.0
pyelasticsearch==0.4.1
django-tastypie-elasticsearch==0.1.0
Run Code Online (Sandbox Code Playgroud)
有人会有解决方案吗?
我正在运行我的python应用程序,requirements.txt其中包含各种依赖项的文件.我正在Pivotal Cloud Foundry环境中部署此应用程序.但是,我在其中部署的环境空气不足.因此我似乎无法获得依赖项.
python CF buildpack的Git repo表明,如果一个应用程序有一个vendor目录,那么它可能会从那里得到依赖项:https://github.com/cloudfoundry/python-buildpack/blob/master/bin/steps/pip-install# L18
我的问题是,如何将我文件中提到的依赖项requirements.txt本地下载到vendor文件夹中?
我正在尝试收集用于文件夹脱机安装的文件。
在一台机器上,我做了pip download -r requirements.txt -d wheelhouse,其中wheelhouse是我所有的whl所在的目录。
然后,我将驾驶室目录移动到远程计算机(没有网络访问权限)。我在那台机器上安装了 miniconda。如何通过一个 swift 命令安装该目录中的所有 whl 文件?
另外,每当我尝试安装单个文件(pip install {path to.whl file})时,我都会得到
Could not fetch URL https://pypi.org/simple/pip/: There was a problem confirming the ssl certificate: HTTPSConnectionPool(host='pypi.org', port=443): Max retries exceeded with url: /simple/pip/ (Caused by SSLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: self signed certificate in certificate chain (_ssl.c:1056)'))) - skipping
Run Code Online (Sandbox Code Playgroud)
但我不想从在线存储库中获取它,因为它已经在那台机器上了。
帮助表示感谢!
我已经使用 django 在虚拟环境中构建了一个站点,并按照 AWS 文档中的步骤部署该站点。我已使用 Elastic Beanstalk 将我的网站部署到 AWS Web 服务器,并设置了运行 3.6 和 django 2.1.1 的 python 环境。我已提取日志并收到以下错误:
Traceback (most recent call last):
File "/opt/python/current/app/weddingProject/wsgi.py", line 12, in <module>
from django.core.wsgi import get_wsgi_application
ModuleNotFoundError: No module named 'django'
Target WSGI script '/opt/python/current/app/weddingProject/wsgi.py' cannot be loaded as Python module.
Run Code Online (Sandbox Code Playgroud)
我读过其他帖子,他们说 django 没有安装,但是,requirements.txt 文件确实将其列为要安装的包。所以我不确定是什么导致了问题,也不知道如何检查服务器以确保它已安装。
当我运行 pip freeze >requirements.txt 时,我确实看到 django 被列为要安装的包。我运行 eb deploy ,但由于某种原因 django 没有安装。
python django amazon-web-services python-3.x amazon-elastic-beanstalk
I have to install python packages form requirements files thats provided to me. However, when I use pip install -r requirements.txt command I get an error saying ERROR: Invalid requirement (from line 3 in requirements.txt. And when I comment the third line the error just continues to be there for the next lines. What does that mean and how can I install packages from the file?
Here's how the file contents look like:
# Name Version Build Channel
alabaster …Run Code Online (Sandbox Code Playgroud) 我是 Docker 的新手,并尝试使用相同的方式部署 django 项目。但是在构建 docker-compose 之后,我收到了这个错误:
错误:无法打开需求文件:[Errno 2] 没有这样的文件或目录:'requirements.txt' 错误:服务 'web' 无法构建:命令 '/bin/sh -c pip install -r requirements.txt'返回非零代码:1
我可能在设置正确的路径时搞砸了,所以这是我的项目结构
~/Desktop/Projects/ToDoApp
ToDoApp
settings.py
docker-compose.yml
Dockerfile
manage.py
requirements.txt
Run Code Online (Sandbox Code Playgroud)
这是我的 dockerfile
#pull official base image
FROM python:3
#set envionment variables
ENV PYTHONUNBUFFERED 1
# Adding requirements file
ADD requirements.txt ToDoApp/ToDoApp
#set work directory
WORKDIR /ToDoApp
#install dependencies
RUN pip install --upgrade pip
RUN pip install -r requirements.txt
CMD ["python", "./ToDoApp/manage.py runserver 0.0.0.0:8000"]
Run Code Online (Sandbox Code Playgroud)
这是我的 docker-compose.yml
version: '3'
services:
web:
build: .
command: python …Run Code Online (Sandbox Code Playgroud) python ×10
pip ×7
python-3.x ×3
django ×2
docker ×1
dockerfile ×1
easy-install ×1
freebsd ×1
packages ×1