Pyinstaller和Cython权限错误:[Error 13]权限被拒绝

2024-05-15 22:39:06 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在尝试集成Cython+Pyinstaller。我想最后用Cython编译这些文件,但它总是给我:[Error 13] Permission denied

我尝试过其他文件夹,给自己完全的管理权限。在

我的原始文件:

from selenium.webdriver import Firefox
from selenium.webdriver.common.by import By
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.firefox.options import Options
from selenium.webdriver.support import expected_conditions as expected
from selenium.webdriver.support.wait import WebDriverWait

if name == "main":
options = Options()
options.add_argument('-headless')
driver = Firefox(executable_path='geckodriver', firefox_options=options)
wait = WebDriverWait(driver, timeout=10)
driver.get('http://www.google.com')
wait.until(expected.visibility_of_element_located((By.NAME, 'q'))).send_keys('headless firefox' + Keys.ENTER)
wait.until(expected.visibility_of_element_located((By.CSS_SELECTOR, '#ires a'))).click()
print(driver.page_source)
driver.quit()

1将py转换为pyx(在Pycharm中重命名)

^{pr2}$

2创建pyd和C文件。 cython -a h1test.pyx它创建了cython-a你的mod.pyxC,pyd文件。在

3创建设置.py文件

正在创建Cython安装程序。。。在

setup(
name="test",
scripts=glob("*"),
ext_modules=cythonize("h1test.pyx")
)

输出:

usage: Setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: Setup.py --help [cmd1 cmd2 ...]
or: Setup.py --help-commands
or: Setup.py cmd --help

error: no commands supplied

Process finished with exit code 1

运行:

python setup.py develop

它创造了测试.鸡蛋-信息文件夹

最后是让我悲伤的事情。在

我将所有内容复制到C:\Users\Stan中\测试.鸡蛋-信息

然后我运行:

pyinstaller -r h1test.cp36-win_amd64.pyd,dll,h1test.cp36-win_amd64.pyd -r h1test.cp36-win_amd64.pyd,dll,h1test.cp36-win_amd64.pyd -F C:\Users\Stan\test.egg-info

错误消息:

C:\Users\Stan\test.egg-info
PermissionError: [Errno 13] Permission denied: 'C:\Users\Stan'

C:\WINDOWS\system32>pyinstaller -r h1test.cp36-win_amd64.pyd,dll,h1test.cp36-win_amd64.pyd -r h1test.cp36-win_amd64.pyd,dll,h1test.cp36-win_amd64.pyd -F C:\Users\Stan\test.egg-info
357 INFO: PyInstaller: 3.3
358 INFO: Python: 3.6.3
360 INFO: Platform: Windows-10-10.0.16299-SP0
362 INFO: wrote C:\WINDOWS\system32\test.spec
364 INFO: UPX is not available.
365 INFO: Extending PYTHONPATH with paths
['C:\Users\Stan', 'C:\WINDOWS\system32']
366 INFO: checking Analysis
366 INFO: Building Analysis because out00-Analysis.toc is non existent
366 INFO: Initializing module dependency graph...
374 INFO: Initializing module graph hooks...
375 INFO: Analyzing base_library.zip ...
3521 INFO: running Analysis out00-Analysis.toc
3523 INFO: Adding Microsoft.Windows.Common-Controls to dependent assemblies of final executable
required by c:\users\Stan\anaconda3\python.exe
4066 INFO: Caching module hooks...
4070 INFO: Analyzing C:\Users\Stan\test.egg-info
Traceback (most recent call last):
File "c:\users\Stan\anaconda3\lib\runpy.py", line 193, in run_module_as_main
"main", mod_spec)
File "c:\users\Stan\anaconda3\lib\runpy.py", line 85, in run_code
exec(code, run_globals)
File "C:\Users\Stan\Anaconda3\Scripts\pyinstaller.exe_main.py", line 9, in 
File "c:\users\Stan\anaconda3\lib\site-packages\PyInstaller_main.py", line 92, in run
run_build(pyi_config, spec_file, **vars(args))
File "c:\users\Stan\anaconda3\lib\site-packages\PyInstaller_main_.py", line 46, in run_build
PyInstaller.building.build_main.main(pyi_config, spec_file, **kwargs)
File "c:\users\Stan\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 791, in main
build(specfile, kw.get('distpath'), kw.get('workpath'), kw.get('clean_build'))
File "c:\users\Stan\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 737, in build
exec(text, spec_namespace)
File "", line 16, in 
File "c:\users\Stan\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 213, in init
self.postinit()
File "c:\users\Stan\anaconda3\lib\site-packages\PyInstaller\building\datastruct.py", line 161, in postinit
self.assemble()
File "c:\users\Stan\anaconda3\lib\site-packages\PyInstaller\building\build_main.py", line 415, in assemble
priority_scripts.append(self.graph.run_script(script))
File "c:\users\Stan\anaconda3\lib\site-packages\PyInstaller\depend\analysis.py", line 201, in run_script
self._top_script_node = super(PyiModuleGraph, self).run_script(pathname)
File "c:\users\Stan\anaconda3\lib\site-packages\PyInstaller\lib\modulegraph\modulegraph.py", line 1326, in run_script

Tags: runinpybuildinfomainlibline