我正在开发一个 python 包。我pip freeze > requirements.txt用来将所需的包添加到requirements.txt 文件中。但是,我意识到一些包,而不是包版本,在它们前面有一些路径。
numpy==1.19.0
packaging==20.4
pandas @ file:///opt/concourse/worker/volumes/live/38d1301c-8fa9-4d2f-662e-34dddf33b183/volume/pandas_1592841668171/work
pandocfilters==1.4.2
Run Code Online (Sandbox Code Playgroud)
而在环境内部,我得到:
>>> pandas.__version__
'1.0.5'
Run Code Online (Sandbox Code Playgroud)
你知道如何解决这个问题吗?
我正在学习本教程:http: //devcenter.heroku.com/articles/django
在某些时候,我倾向于做:
pip freeze > requirements.txt
Run Code Online (Sandbox Code Playgroud)
(来自virtualenv创建的python实例)
我得到了这个:
(venv)przemoli@ubuntu:~/Programowanie/hellodjango$ cat requirements.txt
BeautifulSoup==3.2.0
Brlapi==0.5.5
CherryPy==3.1.2
ClientForm==0.2.10
Django==1.3
GnuPGInterface==0.3.2
PAM==0.4.2
PIL==1.1.7
Routes==1.12.3
Twisted-Core==11.0.0
Twisted-Names==11.0.0
Twisted-Web==11.0.0
WebOb==1.0.8
adium-theme-ubuntu==0.3.1
apt-xapian-index==0.44
apturl==0.5.1ubuntu1
chardet==2.0.1
command-not-found==0.2.44
configglue==1.0
cssutils==0.9.8a1
defer==1.0.2
distribute==0.6.19
django-tagging==0.3.1
dnspython==1.9.4
duplicity==0.6.15
gnome-app-install==0.4.7-nmu1ubuntu2
httplib2==0.7.2
jockey==0.9.4
keyring==0.6.2
launchpadlib==1.9.8
lazr.restfulclient==0.11.2
lazr.uri==1.0.2
louis==2.3.0
lxml==2.3
mechanize==0.1.11
nvidia-common==0.0.0
oauth==1.0.1
onboard==0.96.1
oneconf==0.2.6.7
papyon==0.5.5
pexpect==2.3
piston-mini-client==0.6
protobuf==2.4.0a
psycopg2==2.4.4
pyOpenSSL==0.12
pycrypto==2.3
pycups==1.9.59
pycurl==7.19.0
pyinotify==0.9.1
pyparsing==1.5.2
pyserial==2.5
pysmbc==1.0.10
python-apt==0.8.0ubuntu9
python-dateutil==1.4.1
python-debian==0.1.20ubuntu2
python-virtkey==0.60.0
pyxdg==0.19
sessioninstaller==0.0.0
simplejson==2.1.6
system-service==0.1.6
ubuntu-sso-client==1.4.0
ubuntuone-couch==0.3.0
ubuntuone-installer==2.0.0
ubuntuone-storage-protocol==2.0.0
ufw==0.30.1-2ubuntu1
unattended-upgrades==0.1 …Run Code Online (Sandbox Code Playgroud) 我想requirements.txt在PyCharm中输出我的Python 3项目.有任何想法吗?
我正在尝试使用flask和python.我做了一个名为的简单文件hello.py.tHis文件包含以下代码:
from flask import Flask
app = Flask(__name__)
@app.route("/")
def main():
return "Welcome!"
if __name__ == "__main__":
app.run()
Run Code Online (Sandbox Code Playgroud)
这是一个简单的问候世界.我想执行它,但实际上,我有一个问题.在终端,我打字python hello.py
,我得到这个错误:
File "hello.py", line 1, in <module>
from flask import Flask
ImportError: No module named flask
Run Code Online (Sandbox Code Playgroud)
即使我全球安装了烧瓶.我知道这是一个基本问题,但我被困了?
我想用这个管理依赖模块的小型Python项目:http: //blog.zoomeranalytics.com/pip-install-t/
简而言之,我会这样做:
cd myproject
pip install --target ./pip-libs --upgrade -r requirements.txt
然后将./pip-libs添加到PYTHONPATH并运行我的脚本.
这似乎但我喜欢使用pip冻结,它不允许我做任何事情
pip freeze --target pip-libs
查看文件夹中安装的软件包.当然,我可以看看里面,但是使用--target显示安装在文件夹中的软件包的标准方法是什么?我能想到的唯一方法就是做lspip-libs然后玩grep,awk ......看起来不对.
我不确定是否有办法,也许这不是一个好主意,或者我应该请求pip这样的功能.
Python 2.7.9.
我想知道如何为我的Python 3应用程序创建合适的requirements.txt?
我有一个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)
有人会有解决方案吗?
当我使用时pipreqs,我遇到了这个问题。我使用 anaconda 和俄语 Windows。
root@DESKTOP-ETLLRI1 C:\Users\root\Desktop\resumes
$ pipreqs C:\Users\root\Desktop\resumes
Traceback (most recent call last):
File "C:\Users\root\Anaconda3\Scripts\pipreqs-script.py", line 9, in <module>
sys.exit(main())
File "C:\Users\root\Anaconda3\lib\site-packages\pipreqs\pipreqs.py", line 396, in main
init(args)
File "C:\Users\root\Anaconda3\lib\site-packages\pipreqs\pipreqs.py", line 341, in init
extra_ignore_dirs=extra_ignore_dirs)
File "C:\Users\root\Anaconda3\lib\site-packages\pipreqs\pipreqs.py", line 75, in get_all_imports
contents = f.read()
File "C:\Users\root\Anaconda3\lib\encodings\cp1251.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 1206: character maps to <undefined>
Run Code Online (Sandbox Code Playgroud) 我有一个包含所有已安装软件包的需求文件。在项目的大规模重构过程之后,不再需要列出的一些包。问题是我不确定是哪一个。有没有办法确定requirements.txt文件中列出的哪些包在代码中实际使用?
我有一个很长的 coq 项目列表,我想用opam pin/install. 我想用 opam 安装它们,因为我正在使用这个使用 opam pin/install 的 python 工具(PyCoq)。COQ_PROJ.opam / *.opam给定一个可以使用 make 安装的 coq 项目,如何自动创建一个文件?
例如,适合我的 coq 项目/包 (proj/pkg) 的格式是这样的:https: //github.com/IBM/pycoq/tree/main/pycoq/test/lf
一个想法是,在 pip 中,我们可以轻松地从已安装的 python 项目创建 pip 需求文件(自动创建requirements.txt)。因此,一种可能的解决方案是:
pip freeze > requirements.txt运行与 but for coq等效的命令。如何做到这一点?
coq 项目的示例列表:
[
{
"project_name": "constructive-geometry",
"train_files": [
"problems.v",
"affinity.v",
"basis.v",
"orthogonality.v",
"part1.v",
"part3.v",
"part2.v"
],
"test_files": [],
"switch": "coq-8.10"
},
{
"project_name": "higman-s",
"train_files": …Run Code Online (Sandbox Code Playgroud) python ×8
pip ×5
django ×2
python-3.x ×2
virtualenv ×2
anaconda ×1
coq ×1
deployment ×1
flask ×1
heroku ×1
opam ×1
path ×1
pycharm ×1
python-2.7 ×1