我已经安装了virtualenv,并pywin32在我的Windows 7 64位的笔记本电脑,和他们每个人似乎工作,但不与对方.
更具体地说,如果virtualenv处于活动状态,那么import win32com.client在python交互式shell中运行将失败No module named win32com.client.但是,如果没有virtualenv处于活动状态,则相同的表达式会成功.
当我尝试安装pywin32时pip(这是我通常在virtualenv处于活动状态时安装模块的方式),我收到错误:
Could not find any downloads that satisfy the requirement pywin32
No distributions at all found for pywin32
Run Code Online (Sandbox Code Playgroud)
...即使pywin32是输出中列出的模块之一
pip search pywin32
Run Code Online (Sandbox Code Playgroud)
因此,要安装pywin32 ,我必须使用从SourceForge下载的*.exe安装程序进行安装.
有没有办法
pywin32在virtualenv中安装?
我正在使用 Pyinstaller 将 Django 项目转换为 .exe 文件。我希望能够只需单击一个图标并在浏览器中打开该项目。这是我的文件夹结构:
proj
__pycache__
proj
__pycache__
__init__.py
manage.py
Dashboard
__pycache__
__init__.py
urls.py
proj
__pycache__
__init__.py
settings.py
urls.py
wsgi.py
static_cdn
Run Code Online (Sandbox Code Playgroud)
这是我的manage.py 文件:
# -*- coding: utf-8 -*-
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "proj.settings")
print("here")
try:
from django.core.management import execute_from_command_line
except ImportError as exc:
raise ImportError(
"Couldn't import Django. Are you sure it's installed and "
"available on your PYTHONPATH environment variable? Did you "
"forget to activate a virtual environment?"
) from …Run Code Online (Sandbox Code Playgroud) 我有一个包含一系列列表项的 HTML 页面。我希望能够按下一个按钮,读取列表中的数据,并进行某种转换。我认为它会更像这个例子。
但是,这种格式使用 name 属性来获取数据,并且列表或列表项都不能有名称!
我的 HTML:
<form action="{% url 'index' %}" method="POST">
{% csrf_token %}
<ul id="myList">
<li id="myId1">First Item</li>
<li id="myId2">Second Item</li>
</ul>
<button type="submit">Submit</button>
</form>
Run Code Online (Sandbox Code Playgroud)
我的蟒蛇:
def index(request):
if request.method == 'POST':
var = request.POST['myList']
print(var)
return render(request, "test.html", {})
Run Code Online (Sandbox Code Playgroud)
有没有办法获取列表中的项目?
附加信息:
None.var = request.POST.get('myList'),甚至开始处理表单和模型,但我只能以这种方式获取模型中的数据,而不是<li>.python ×3
django ×2
executable ×1
html ×1
list ×1
post ×1
pyinstaller ×1
pywin32 ×1
virtualenv ×1