我使用python2.7和pycharm作为ide。我有两个名为experiment.py和low_dim_cython.pyx的文件。当我尝试运行我的代码experiment.py时,它会从low_dim_cython导入函数时抛出访问被拒绝错误。以下代码属于experiment.py:
import numpy
import pyximport
pyximport.install(setup_args={'include_dirs':[numpy.get_include()]})
from low_dim_cython import read_basis, Dataset, AnonymizationScheme
给出错误:
Traceback (most recent call last):
File "C:/PycharmProjects/deepLearning/PriView/experiment.py", line 23, in <module>
from low_dim_cython import read_basis, Dataset, AnonymizationScheme, ensure_non_negative_consistency
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\site-packages\pyximport\pyximport.py", line 458, in load_module
language_level=self.language_level)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\site-packages\pyximport\pyximport.py", line 233, in load_module
exec("raise exc, None, tb", {'exc': exc, 'tb': tb})
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\site-packages\pyximport\pyximport.py", line 215, in load_module
inplace=build_inplace, language_level=language_level)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\site-packages\pyximport\pyximport.py", line 191, in build_module
reload_support=pyxargs.reload_support)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\site-packages\pyximport\pyxbuild.py", line 102, in pyx_to_dll
dist.run_commands()
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\distutils\dist.py", line 953, in run_commands
self.run_command(cmd)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\distutils\dist.py", line 972, in run_command
cmd_obj.run()
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\site-packages\Cython\Distutils\old_build_ext.py", line 185, in run
_build_ext.build_ext.run(self)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\distutils\command\build_ext.py", line 340, in run
self.build_extensions()
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\site-packages\Cython\Distutils\old_build_ext.py", line 193, in build_extensions
self.build_extension(ext)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\distutils\command\build_ext.py", line 499, in build_extension
depends=ext.depends)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\distutils\msvc9compiler.py", line 473, in compile
self.initialize()
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\distutils\msvc9compiler.py", line 383, in initialize
vc_env = query_vcvarsall(VERSION, plat_spec)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\distutils\msvc9compiler.py", line 275, in query_vcvarsall
stderr=subprocess.PIPE)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\subprocess.py", line 390, in __init__
errread, errwrite)
File "C:\AppData\Local\Continuum\Anaconda3\envs\priview2.7\lib\subprocess.py", line 640, in _execute_child
startupinfo)
ImportError: Building module low_dim_cython failed: ['WindowsError: [Error 5] Access is denied\n']
我已经给了pycharm和python.exe的所有权限,但它没有改变任何东西。