我正在编写一个小的 python 脚本,它需要频繁执行才能调试和进一步开发。
我可以拆分 vim 屏幕并通过击键在一个部分执行我的脚本吗?
我目前使用的是 Windows XP 32 位机器,我正在尝试制作一些 gimp 插件。我昨天刚学了 Python,我在这里保存了一个示例脚本:C:\Program Files\GIMP-2.0\share\gimp\2.0\scripts.我不知道为什么,但它根本没有出现在 Gimp 中。我还注意到,自从我升级到 Gimp 2.8 后,所有内置插件都不再位于此文件夹中。他们应该去别的地方吗?
我正在使用ipython3,安装在 Ubuntu 上apt-get。我无法使用粘贴魔法功能,它抱怨缺少Tkinter. 但是我确实有Tkinter并且同样的事情在 ipython (2) 上运行良好。是什么赋予了?
Python 3.2.3 (default, Oct 19 2012, 19:53:16)
Type "copyright", "credits" or "license" for more information.
IPython 0.13.1.rc2 -- An enhanced Interactive Python.
? -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help -> Python's own help system.
object? -> Details about 'object', use 'object??' for extra details.
In [1]: %paste
ERROR: Getting text from the clipboard on this platform requires Tkinter.
Run Code Online (Sandbox Code Playgroud) 我正在尝试为 Chromium/Chrome 设置同步服务器,但我完全失败了。我也找不到相关的操作方法(如 Firefox 中的这个)。
我只在10 年的超级用户和相应的铬错误中发现了这个问题,该错误表明--sync-url="<your server here>"需要命令行标志。
有人可以帮助我并告诉我在 Ubuntu 上设置同步服务器需要做什么的确切说明吗?
Anaconda管理环境的文档指出,使用以下方法激活环境:
source activate <env-name>
Run Code Online (Sandbox Code Playgroud)
我注意到安装 conda 后,activate在路径中:
$ which activate
/Users/dilum/anaconda/bin/activate
Run Code Online (Sandbox Code Playgroud)
source 是否也在路径中找到文件?我想第二个参数(环境名称)只是由activate脚本处理?
在使用pip安装Jupiter Notebook的过程中,它说脚本安装在不在PATH上的文件夹中。它会导致任何问题吗?我该如何解决?
这是完整的日志:
Installing collected packages: six, ipython-genutils, decorator, traitlets, jupyter-core, jsonschema, nbformat, tornado, pyzmq, entrypoints, pygments, MarkupSafe, jinja2, webencodings, bleach, mistune, pandocfilters, testpath, defusedxml, nbconvert, Send2Trash, wcwidth, prompt-toolkit, parso, jedi, colorama, pickleshare, backcall, ipython, python-dateutil, jupyter-client, ipykernel, pywinpty, terminado, prometheus-client, notebook
The scripts jupyter-migrate.exe, jupyter-troubleshoot.exe and jupyter.exe are installed in 'c:\users\??????\appdata\local\programs\python\python37\Scripts' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
The script jsonschema.exe is installed in 'c:\users\??????\appdata\local\programs\python\python37\Scripts' …Run Code Online (Sandbox Code Playgroud) 我正在使用 Python 3.7.3 对我网站上托管的 PHP 文件运行 GET 请求。但是,当我运行它时,我收到以下错误。我已经安装requests过pip3的家酿。我正在使用 macOS Mojave。
回溯(最近一次调用):
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py”,第600行,在urlopen chunked=chunked中)
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py”,第 343 行,在 _make_request self._validate_conn(conn)
文件“/Library/Frameworks/Python .framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py”,第 839 行,在 _validate_conn conn.connect()
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib /python3.7/site-packages/urllib3/connection.py”,第 344 行,在连接 ssl_context=context 中)
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/util/ssl_.py”,第 344 行,在 ssl_wrap_socket 中
返回 context.wrap_socket(sock, server_hostname=server_hostname)
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py”,第 412 行,在 wrap_socket session=session
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib /python3.7/ssl.py”,第 853 行,在 _create self.do_handshake()
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py”,第 1117 行,在do_handshake self._sslobj.do_handshake()
ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] 证书验证失败:无法获得本地颁发者证书 (_ssl.c:第1056章)在处理上述异常的过程中,又发生了一个异常:
回溯(最近一次调用最后一次):
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/requests/adapters.py”,第 449 行,发送超时=超时
文件“ /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/connectionpool.py", line 638, in urlopen _stacktrace=sys.exc_info()[2])
文件“/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/urllib3/util/retry.py”,第398行,以递增方式引发MaxRetryError(_pool, url, error or ResponseError(原因)) urllib3.exceptions.MaxRetryError: …
我正在尝试使用 git-filter-repo 从我的存储库中删除大型二进制文件。我以前没有使用过python。我通过单击下载的 .exe 文件安装了最新的 python,因为这是 git-filter-repo 的要求。指令说:
git-filter-repo 是一个单文件 python 脚本,它是为了使基本使用的安装变得简单:只需将它复制到您的 $PATH 中
https://github.com/newren/git-filter-repo/#how-do-i-install-it
我试过用 python 应用程序打开 git-filter-repo.py。我也不能在 python 应用程序中使用 cd、ls 或 dir。
每次我使用 pip 安装 python 库(例如pip install requests)时,我都必须重新加载 Visual Studio Code,因此它开始扫描已安装的库(即使pip install在 VS-Code 激活的 shell 中使用 - 命令时也是如此)。
如果我不这样做,我就没有该库的“智能感知”,并且导入只会显示带有未解析导入的波形曲线。
有没有办法“修复”这个问题而无需重新加载窗口(Command Palette > Reload Window)?
我试图让 Selenium 在 Windows 机器上使用 phantomjs。我的代码编译没有任何错误:
from selenium import webdriver
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities
import cookielib
import re
from splinter import Browser
driver = webdriver.PhantomJS('C:/Program Files (x86)/phantomjs-1.9.2-windows')
Run Code Online (Sandbox Code Playgroud)
但是每次我运行它我都会收到错误
Traceback (most recent call last):
File "E:/~PROJECT/disinfo/py/bs.py", line 8, in <module>
driver = webdriver.PhantomJS('C:/Program Files (x86)/phantomjs-1.9.2-windows')
File "C:\Python27\lib\site-packages\selenium\webdriver\phantomjs\webdriver.py", line 50, in __init__
self.service.start()
File "C:\Python27\lib\site-packages\selenium\webdriver\phantomjs\service.py", line 63, in start
raise WebDriverException("Unable to start phantomjs with ghostdriver.", e)
selenium.common.exceptions.WebDriverException: Message: 'Unable to start phantomjs with ghostdriver.' ; Screenshot: available via screen
Run Code Online (Sandbox Code Playgroud)
我已经收到这个错误几个小时了。“无法使用 ghostdriver …