我如何开始使用斜纹布?

发布于 2024-08-29 06:46:27 字数 6849 浏览 0 评论 0 原文

很抱歉我已经在“超级用户”上问过这个问题,但没有人回答,所以我从“超级用户”中删除了它并决定将其发布在这里。希望这不是一个大犯罪,特别是考虑到我首先被建议在“StackOverflow”(而不是“SuperUser”)上使用斜纹布,

我如何开始使用斜纹布?我刚刚下载它,解压它并单击文件夹中的 setup .py 文件。黑色的窗口(终端)出现了一会儿就消失了。

(我的计算机上确实安装了 Python 2.5 - 以及来自 Google App Engine 的 SDK)

在斜纹布中 文档部分 它说:


下载斜纹布

最新发布的斜纹布是斜纹布 0.9,2007 年 12 月 27 日星期四发布;它可以在以下位置下载: http://darcs.idyll.org/~t/projects/ twill-0.9.tar.gz。 您还可以使用Python的easy_install 安装或升级斜纹布。

斜纹适用于 Python 2.3 或更高版本。

要开始使用 twill,请安装它并 然后输入 twill-sh。根据提示 类型:

前往http://www.slashdot.org/
显示
显示表单
显示历史


从这段文字中我不清楚我应该输入什么(只有“twill-sh”或“twill-sh”以及该行下的所有单词)以及在哪里(我尝试在我计算机的命令提示符窗口 - 无济于事)

任何人都可以帮助我吗?

先感谢您。


更新1:(

此更新是对S.Mark给出的答案的回应)

您好,S.Mark!!!! 我已尝试遵循您的指示。事情是这样的:

首先,我在 D 盘上创建了一个文件夹,并将其命名为“tmp”。然后我下载了 twill-0.9 并将其解压到该文件夹​​中。因此,现在我计算机上该文件的路径与您的示例中的路径相同: D:\tmp\twill-0.9 : 替代文本
(来源:narod.ru

替代文本
(来源:
narod.ru

然后,我尝试了在我的计算机上打开命令提示符: 替代文本
(来源:narod.ru

alt text
(来源:
narod.ru

alt text
(来源:
narod.ru

alt text
(来源:
narod.ru

alt text
(来源:
narod.ru

然后,执行以下步骤2 你的指示,我尝试切换到D盘:

替代文字
(来源:narod.ru

但由于某种原因它不起作用:


(来源:narod.ru

这句中文说诸如“此操作已被拒绝”之类的内容。为什么会这样呢? 好吧,无论如何,我尝试继续执行步骤 3,这就是我得到的:

替代文字
(来源:narod.ru

据我所知可以理解,这句中文的意思是“‘C:\’既不是内部命令,也不是外部命令,因此无法执行。 ” 为什么会这样呢?我的电脑有问题吗?


更新2:(

此更新是我对S.Mark给出的答案的第二次回复)

你好,S.Mark!再次感谢您的回答。

是的,这次当我刚刚输入您在帖子中突出显示的那些部分时,它就起作用了。所以,当我一开始只输入“d:”时,它就起作用了!

但是,当我输入“python setup.py build”时,我收到了相同的错误消息(“'python'既不是内部命令也不是外部命令;它无法执行。”): 替代文本
(来源:narod.ru

我试图重复这个命令不小心漏掉了“python”这个词:
替代文本
(来源:narod.ru

当我按下“ Enter”键,构建过程似乎启动了 - 至少我看到的与您的说明中的步骤 4(“启动构建过程”)非常相似: 替代文本
(来源:narod.ru
替代文本
(来源:narod.ru
替代文本
(来源:narod.ru

但现在我是对于是否继续执行步骤 5(“安装”)有点犹豫,因为我不确定我所做的是否正确。

如果我在步骤 4 中所做的没问题,我是否也应该在步骤 5 中省略“python”一词?

附带问题:您是如何在不进行屏幕截图的情况下将终端的内容放入您的帖子中的?是否有某种方法可以将终端的内容放入剪贴板?一直制作屏幕截图并在发布之前托管它们是相当麻烦的。


更新3:(

这是我对S.Mark的第三次回复)

S.Mark,你好!

(希望你还没有厌倦我)

“…是的,你可以省略 python 并直接运行 setup.py,因为你的 python 安装在注册表中注册了 *.py…关于步骤 5,你可以只运行 setup.py install” – 我按照您的这些话进行操作,安装过程成功运行!谢谢。

但对于以下步骤(“然后从开始菜单打开 python 提示符,并测试步骤 6 和 8”),Python 提示符并没有取得太大成功: 替代文本
(来源:narod.ru

都没有成功在通常的命令提示符(终端)中: 替代文本
(来源:narod.ru

(它再次说在中文中,python“既不是内部命令,也不是外部命令,因此无法执行”)。您知道为什么它不起作用吗?

“……你的Python安装在哪里? C:\Python25?” - 是的,没错。

“……有一个设置(命令提示符属性 - 轻松编辑模式)可以在命令提示符上选择文本,您可以在 superuser.com 中询问吗?” - 当然,我会在那里问这个问题。谢谢你告诉我。

I am sorry I have already asked this question on "Superuser", but nobody answers there, so I deleted it from "Superuser" and decided to post it here. Hope it's not a big crime, especially given the fact that I was firstly advised to use twill here on "StackOverflow" (not on "SuperUser")

How do I start using twill? I have just downloaded it, unpacked it and clicked on the setup .py file in the folder. The black window (terminal) appeared for a moment and vanished.

(I do have Python 2.5 installed on my computer - along with SDK from Google App Engine)

In the twill documentation section it says:


Downloading twill

The latest release of twill is twill
0.9, released Thursday, December 27th, 2007; it is available for download at
http://darcs.idyll.org/~t/projects/twill-0.9.tar.gz.
You can also use Python's easy_install
to install or upgrade twill.

twill works with Python 2.3 or later.

To start using twill, install it and
then type twill-sh. At the prompt
type:

go http://www.slashdot.org/
show
showforms
showhistory


I am not clear from this passage what I am supposed to type (only "twill-sh" or "twill-sh" and all the words under that line) and where (I tried typing it in the command prompt window of my computer - to no avail)

Can, anyone, please, help me out here?

Thank You in advance.


Update 1:

(This update is a response to the answer given by S.Mark)

Hello, S.Mark!!!!
I’ve tried to follow Your instructions. Here is what happened:

Firstly, I created a folder on my D disk and named it “tmp”. Then I downloaded and extracted twill-0.9 into that folder. So, now the path to this file on my computer was just as same as the one in Your example: D:\tmp\twill-0.9 :
alt text
(source: narod.ru)

alt text
(source: narod.ru)

Then, I tried to open the command prompt on my computer:
alt text
(source: narod.ru)

alt text
(source: narod.ru)

alt text
(source: narod.ru)

alt text
(source: narod.ru)

alt text
(source: narod.ru)

Then, following step 2 of Your instructions, I tried to switch to D disk:

alt text
(source: narod.ru)

But for some reason it didn’t work:

alt text
(source: narod.ru)

This Chinese line says something like “This action has been rejected.” Why is it so?
Well, I tried to proceed to step 3 anyway, and here is what I’ve got:

alt text
(source: narod.ru)

As far as I can understand, this Chinese line says something like “ ’C:\’ is neither internal nor external command, thus, it cannot be carried out. ”
Why is it so? Is there something wrong with my computer?


Update 2:

(This update is my second response to the answer given by S.Mark)

Hello, S.Mark!!! Thank You for Your answer again.

Yes, this time it worked when I just typed those parts that You highlighted in Your post. So, when I typed just “d:” in the very beginning, it worked!!!

But then, when I typed “python setup.py build”, I got the same error message (“ ’python’is neither an internal or external command; it can’t be carried out. “) :
alt text
(source: narod.ru)

I tried to repeat this command and accidentally omitted the word “python”:
alt text
(source: narod.ru)

When I pressed “Enter” key, the build process seemed to launch - at least what I saw then resembled the step 4 of Your instructions (“start the build process”) very much:
alt text
(source: narod.ru)
alt text
(source: narod.ru)
alt text
(source: narod.ru)

But now I am a little bit hesitant about proceeding to step 5 (“Install It”) as I am not sure if what I have done is the right thing.

If what I did in step 4 was okay, should I also omit the word “python” in step 5?

A side question: How did You manage to put the contents of the terminal into Your post without making screenshots? Is it like there is some way of putting the terminal’s contents into the clipboard? Making screenshots all the time and hosting them prior to posting is quite cumbersome.


Update 3:

(This update is my third response to S.Mark)

S.Mark, hello again!!!

(Hope you are not sick and tired of me yet)

“…and yeah you could omit python and directly run setup.py because your python installation registered *.py in registry… regarding step 5, you could just run setup.py install” – I followed these words of Yours and install process ran successfully! Thank You.

But as for the following steps (“then open python prompt from start menu, and test step 6 and 8”), there wasn’t much success in the Python prompt:
alt text
(source: narod.ru)

Neither was it successful in the usual command prompt (terminal):
alt text
(source: narod.ru)

(It again says in Chinese that python “is neither an internal nor external command and, therefore, can’t be carried out”). Do You have any idea why it didn’t work?

“…where is your python installation? C:\Python25?”
- Yes, that’s right.

“…there is a setting (command prompt properties - easy edit mode) to enable selection of text on the command prompt, could you ask that in superuser.com?”
- Sure, I will ask this question there. Thanks for telling me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凉宸 2024-09-05 06:46:27

您不能只双击 setup.py

您需要打开命令提示符或 shell 并转到该文件夹

​​,并且需要执行

python setup.py build
python setup.py install

安装步骤应该自动正常构建,因此只有最后一个可以工作


编辑:好的,这是超级用户方式的安装步骤

  1. 我已将 twill-0.9.tar.gz 提取到 D:\tmp\twill-0.9

  2. 我在驱动器 C 上,所以我切换到 D:

    C:\>d:
  3. 现在,使用 cd 命令更改文件夹

    C:\>cd D:\tmp\twill-0.9
  4. 开始构建过程

    D:\tmp\twill-0.9>python setup.py build
    (警告:导入 distutils,而不是 setuptools!)
    D:\data\program\Python26\lib\distutils\dist.py:266: UserWarning: 未知的分发选项: 'entry_points'
      警告.warn(msg)
    D:\data\program\Python26\lib\distutils\dist.py:266: UserWarning: 未知的分发选项: 'test_suite'
      警告.warn(msg)
    运行构建
    运行build_py
    创建构建
    创建构建\lib
    创建 build\lib\twill
    ......
    运行构建脚本
    创建 build\scripts-2.6
    复制和调整斜纹叉 -> build\scripts-2.6
  5. 安装它

    D:\tmp\twill-0.9>python setup.py install
    (警告:导入 distutils,而不是 setuptools!)
    运行安装
    运行构建
    运行build_py
    ......
    运行 install_scripts
    复制 build\scripts-2.6\twill-fork -> D:\数据\程序\Python26\脚本
    运行 install_egg_info
    写入 D:\data\program\Python26\Lib\site-packages\twill-0.9-py2.6.egg-info
  6. 测试导入是否

    D:\tmp\twill-0.9>python
    Python 2.6.5(r265:79096,2010 年 3 月 19 日,21:48:26)[MSC v.1500 32 位(英特尔)] 在 win32 上
    输入“帮助”、“版权”、“制作人员”或“许可证”以获取更多信息。  
    >>>>> 进口斜纹布
      导入 re、base64、urlparse、posixpath、md5、sha、sys、复制
    twill\other_packages\_mechanize_dist\_auth.py:14: DeprecationWarning: sha 模块已弃用;使用 hashlib 模块代替
      导入 re、base64、urlparse、posixpath、md5、sha、sys、复制
    >>>
  7. 导入很好,但是在 python 2.6 上有 DeprecationWarnings,但这应该没问题,并且对于 python 2.5 应该根本没有警告

  8. 确认其是否正确导入,您将在那里看到 twill 及其函数,所以是的。< /p>

    <前>>>>> 目录()
    ['__builtins__', '__doc__', '__name__', '__package__', '斜纹']
    >>>>> 从 twill.commands 导入 *
    >>>>> 目录()
    ['__builtins__'、'__doc__'、'__name__'、'__package__'、'add_auth'、'add_extra_header'、'代理'、'返回'、'clear_cookies'、'clear_extra_headers'、'代码'、'配置'、'调试'、'回显'、'退出'、'extend_with'、'fa'、'查找'、'跟随
    >>

You cannot just double click setup.py

You need to open command prompt or shell and go to that folder

and need to do

python setup.py build
python setup.py install

install step should automatically do build normally, so only last one will work


Edit: ok, here is superuser way of installation steps

  1. I have extracted twill-0.9.tar.gz to D:\tmp\twill-0.9

  2. I am on drive C, so I switched to D:

    C:\>d:
  3. Now, change the folder by using cd command

    C:\>cd D:\tmp\twill-0.9
  4. start the build process

    D:\tmp\twill-0.9>python setup.py build
    (WARNING: importing distutils, not setuptools!)
    D:\data\program\Python26\lib\distutils\dist.py:266: UserWarning: Unknown distribution option: 'entry_points'
      warnings.warn(msg)
    D:\data\program\Python26\lib\distutils\dist.py:266: UserWarning: Unknown distribution option: 'test_suite'
      warnings.warn(msg)
    running build
    running build_py
    creating build
    creating build\lib
    creating build\lib\twill
    ......
    running build_scripts
    creating build\scripts-2.6
    copying and adjusting twill-fork -> build\scripts-2.6
  5. Install it

    D:\tmp\twill-0.9>python setup.py install
    (WARNING: importing distutils, not setuptools!)
    running install
    running build
    running build_py
    ......
    running install_scripts
    copying build\scripts-2.6\twill-fork -> D:\data\program\Python26\Scripts
    running install_egg_info
    Writing D:\data\program\Python26\Lib\site-packages\twill-0.9-py2.6.egg-info
  6. Test for import is or not

    D:\tmp\twill-0.9>python
    Python 2.6.5 (r265:79096, Mar 19 2010, 21:48:26) [MSC v.1500 32 bit (Intel)] on win32
    Type "help", "copyright", "credits" or "license" for more information.  
    >>> import twill
      import re, base64, urlparse, posixpath, md5, sha, sys, copy
    twill\other_packages\_mechanize_dist\_auth.py:14: DeprecationWarning: the sha module is deprecated; use the hashlib module instead
      import re, base64, urlparse, posixpath, md5, sha, sys, copy
    >>>
  7. Import was fine, but there is DeprecationWarnings on python 2.6, but this should be ok and should be no warnings at all with python 2.5

  8. confirm its properly imported or not, you will see twill and its functions there, so yes.

    >>> dir()
    ['__builtins__', '__doc__', '__name__', '__package__', 'twill']
    >>> from twill.commands import *
    >>> dir()
    ['__builtins__', '__doc__', '__name__', '__package__', 'add_auth', 'add_extra_header', 'agent', 'back', 'clear_cookies', 'clear_extra_headers', 'code', 'config', 'debug', 'echo', 'exit', 'extend_with', 'fa', 'find', 'follow
    >>>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文